tags:

views:

672

answers:

3

Hi I am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh.

After run "git commit -a" on my local side, to send the changes to the remote, I run

$ git push
Everything up-to-date

However I checked the remote files and they are not changed! Any idea?

Thanks and regards!

+1  A: 

have you tried the following?

 $ git push origin master:master
knittl
It doesn't work. :(What is this supposed to do?
Tim
push your local changes on master to origin's branch master
knittl
+3  A: 

You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning git push gives you if it notices that this is the case.

Anyway, log in to the remote machine, change to the repository and do

git checkout <whatever branch you’re on>

There you go. Next time only push into bare repositories. :)

Bombe
I managed to solve this problem as what you said but I am still confused and not understand what I was doing. Does non-bare means that I can edit files in the repository directly and bare means that the files in the repository does not allow to be edited? What kind of warning git push gives, which I didn't notice?Thanks!
Tim
A “bare” repository is a repository that does not have a working copy, i.e. you can not edit any files in it. The repository path directly contains everything that is normally in the `.git` folder of a non-bare repository, and in fact a bare repository is only this folder. When pushing to a non-bare repository you do *not* change the files that are currently checked out. You need to update the working code separately, e.g. with `git checkout` or `git reset`.
Bombe
+1  A: 

I suggest you look into using gitosis for hosting those git bare repositories. It's really easy to use after the initial setup.

Luis