I do:
$ git commit .
$ git push
error: Entry \'file.php\' not uptodate. Cannot merge.
Then I do
$ git pull
Already up-to-date.
This is just a hunch, but was your remote a bare repo or a working directory? If it was a working directory rather than a bare repo, the file.php
file on the remote had uncommitted changes. Your git push
command was trying to advance the HEAD
at the remote which was causing conflicts due to the uncommitted changes.
This is why you usually git pull
to update a working directory, and use git push
on bare repos. FYI, to setup a bare repo for use as something similar to a central CVS/SVN/etc repo, do the following on the remote:
$ mkdir my-git-repo $ cd my-git-repo $ git init --bare
Then in your local repo:
$ cd my-git-repo.git $ git remote add origin user@host:/path/to/my-git-repo/ $ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master $ git push origin master
Now you have a bare repo to push/pull into/from that contains your master branch. You can repeat the last three local steps with any additional local branches you want to put on the remote. Cloning is the same as before and you don't need to use git config
as remotes are set automatically and remote merging refs are set when you use tracking branches.
Hope that helps.