fatal: did you run git update-server-info on the server? - Not using github
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)
wdphd
Updated on June 26, 2022Comments
-
wdphd almost 2 years
1. I followed the following tutorial to setup git for web development on my private server.
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.
-
wdphd over 10 yearsThanks this worked! I made some changes to my local server and pushed it to my private server. But the changes are still not reflected.
-
VonC over 10 years@wdphd probably because you are pushing to a non-bare repo, which is,'t recommended. You need to
git checkout master
in your server destination repo for its working tree to update itself. -
VonC over 10 years@wdphd see for why a non-bare repo is not updated by a push: stackoverflow.com/a/3761891/6309. And regarding bare repos: gitolite.com/concepts/bare.html
-
wdphd over 10 yearsNo, im not pushing into non bare repo. From the tut: $ cd /var/git/myproject.git $ git init --bare $ cd /var/www/myproject $ git push /var/git/myproject.git master
-
VonC over 10 years@wdphd then it seems normal to not see any file in a bare repo. The
post-update
hook should update the non-bare repo though. Make sure it is executable (chmod 755
). -
wdphd over 10 yearsRechecked the whole code again. It still says everything upto date
-
VonC over 10 years@wdphd and you do have a
/var/git/myproject.git/hooks/post-update
file, executable? And you have a remote named "hub
" correctly declared? Whatgit remove -v
returns when executed in/var/git/myproject.git
? -
wdphd over 10 yearsYes, the post-update hook is executable. git remote -v in /var/git/myproject.git doesn't return anything. But i have added [remote "hub"] url = /var/git/myproject.git fetch = +refs/heads/*:refs/remotes/hub/* into
/var/www/html/.git/config
-
VonC over 10 years@wdphd I have edited the answer to make the necessary steps (regarding the hook) clearer.
-
wdphd over 10 yearsThanks for the update man. When i try to add the remote hub, it already exists. I'm a beginner in git so please excuse me for this extended discussion
-
VonC over 10 years@wdphd sure, if you already edited the config file manually, you don't have to do a
git remote add
: it would indeed already exist. I was just pointing out the 'git' way to add a remote. -
wdphd over 10 years