Murtaza Lokhandwala Murtaza Lokhandwala - 3 months ago 9
Git Question

source code not pushed to git server via ssh from eclipse

Using Eclipse, I try to push git repository to Git server after making changes in a java file & commit via ssh.

Problem: Only the commit info are pushed to Git server but not the actual java source code.

How can I push java code to Git server from Eclipse?

Answer

Following the Egit tutorial on committing changes, make sure you have added the source code which just changed, before committing.

If you don't select Team > Add, the commit won't include those changes.

You must see files in the stages changes part of the commit dialog:

https://wiki.eclipse.org/images/f/ff/Egit-3.1-StagingView.png

Alternatively you may display untracked files in the Commit dialog and check the Show untracked Files checkbox to select them for inclusion into the commit.


As for a post-receive hook, it is best if you set GIT_DIR in addition of GIT_WORK_TRE. See this example:

 #!/bin/sh
 unset GIT_INDEX_FILE
 export GIT_WORK_TREE=/var/www/example/
 export GIT_DIR=/home/mark/test/.git/
 git checkout -f
Comments