Viratan Viratan - 8 hours ago 2
Git Question

How to add java code from eclipse to git repository

I am on a windows machine and my .java files are stored on my disk (C:\Users\myname\workspace..etc)

I have a git repository set up in a cloud and I SSH to it using putty.

My question is, how do I add the files in my workspace to the repository?

When I do

git add
the linux terminal says it cannot find specified file.

So do I some how bring the the copies of the java files into this terminal directory?

Btw I'm using an Atlassian Stash on Amazon Web Services.


Go to current working directory to your local project and run following commands:

Step 1 : Initializes a new Git repository. Until you run this command inside a repository or directory, it’s just a regular folder. Only after you input this does it accept further Git commands.

git init

Step 2 : This does not add new files to your repository. Instead, it brings new files to Git’s attention. After you add files, they’re included in Git’s “snapshots” of the repository.

git add .

Step 3: Check the status of your repository. See which files are inside it, which changes still need to be committed, and which branch of the repository you’re currently working on.

git status

Step 4: Git’s most important command. After you make any sort of change, you input this in order to take a “snapshot” of the repository. Usually it goes git commit -m “Message here.” The -m indicates that the following section of the command should be read as a message.

git commit -m "Committing Files - Message"

Step 5: Add origin to the .gitconfig file.

git remote add origin <url to your git repo.git>

Step 6: Push the changes from your local repository.

git push -u origin master