fatal: did you run git update-server-info on the server? - Not using github

wdphd picture wdphd · Oct 13, 2013 · Viewed 14.9k times · Source

1. I followed the following tutorial to setup git for web development on my private server.

Using git for Deployment

Im getting the following error while using

git push origin master

fatal: http://mysite.com/.git/info/refs?service=git-receive-pack not found: did you run git update-server-info on the server?

I followed through various questions on stackoverflow which all points to creating a repository before using git push but i already have a git repository.

2 . When i visit mysite.com/.git , the complete .git repository is displayed. How do i disable this and just enable git push to the same.

Answer

VonC picture VonC · Oct 13, 2013

A remote url like http://mysite/.git is certainly not a valid one.

It should refer to a bare repo name like, from the tutorial you reference, 'myproject/.git':

git remote set-url origin dan@server:/var/git/myproject.git

(Replace dan by the user account you used to setup a git repo in /var/www/myproject).


The OP wdphd confirms it works, but the non-bare repo isn't updated.

That is because the hook is pushing to "hub", and that remote need to be declared:

cd /var/www/myproject/.git
git remote add hub /var/git/myproject.git

(easier than editing /var/www/myproject/.git/config directly)