I'm having trouble pushing my code to a git remote repository from my localhost. This problem only appears for repositories that were initially created with remote urls that are system directories (eg. /var/www/lib) and later accessed via remote urls that are http urls (eg. http://mysite.com/repo.git). Here's the error I'm getting:
Fetching remote heads...
refs/
refs/tags/
refs/heads/
fetch 023264fe3e5e24075307512502599d279c1a1640 for refs/heads/master
error: remote 'refs/heads/master' is not an ancestor of
local 'refs/heads/master'.
Maybe you are not up-to-date and need to pull first?
fatal: git-http-push failed
Here are the steps to creating the problem. Initially, I populated the remote bare repository from the remote server itself like so:
cd /var/www/
git init
git add .
git commit -m 'test'
git remote add newproject /var/lib/git/newproject.git ## I suspect the problem begins here
git push newproject master
For about a week, I've been committing, pulling and pushing without problems because I was working directly off of the remote server from /var/www/. Then today, I installed webdav so that I can push and pull from my local host. I'm pretty sure I installed and configured git and apache properly. So from my localhost, here's what I did:
cd /home/user/newproject/
git init
git remote add newproject http://www-data@website.com/newproject.git # this is different from above where i used /var/lib/git/newproject
git pull newproject master #worked perfectly
vi test.html
git add test.html
git commit -m 'test'
git push newproject master
Then I get the error as first mentioned. A pull did not fix this problem. All new repositories made with the http versions have no problem with push and pull. Only old repositories that were first made with /var/lib/git are having problems when switching to the http version.
Does anyone know how to fix this?