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

14,982

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)

Share:
14,982
wdphd
Author by

wdphd

Updated on June 26, 2022

Comments

  • wdphd
    wdphd almost 2 years

    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.

  • wdphd
    wdphd over 10 years
    Thanks 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
    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
    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
    wdphd over 10 years
    No, 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
    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
    wdphd over 10 years
    Rechecked the whole code again. It still says everything upto date
  • VonC
    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? What git remove -v returns when executed in /var/git/myproject.git?
  • wdphd
    wdphd over 10 years
    Yes, 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
    VonC over 10 years
    @wdphd I have edited the answer to make the necessary steps (regarding the hook) clearer.
  • wdphd
    wdphd over 10 years
    Thanks 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
    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
    wdphd over 10 years