14

I receive the following error:

fatal: https://github.com/username/repository-name.git/info/refs not found: did you run git update-server-info on the server?

if I try to push my repository without creating it first on github.com. If I create my repository first on github, then I can push branches no problem. Is this procedure routine? Or am I doing something wrong? I thought a repository could be created locally and pushed without first creating it on github.

B6431
  • 317
  • 1
  • 4
  • 13

7 Answers7

21

fatal: https://github.com/username/repository-name.git/info/refs not found: did you run git update-server-info on the server?

In GitHub context, this message should be understood as "The repository doesn't exist". You're supposed to push toward an already existing bare repository. A bare repository is a repository without a working directory, usually found server-side.

If I create my repository first on github, then I can push branches no problem. Is this procedure routine?

Yes. You're supposed to first create your repository on GitHub. See the help topic about this

indeed, as stated by the documentation "To put your project up on GitHub, you'll need to have a GitHub repository for it to live in."

nulltoken
  • 64,429
  • 20
  • 138
  • 130
  • Thank you for the quick answer and the link. I going to read the create-a-repo article. – B6431 Sep 13 '12 at 14:18
  • For some reason neither my client `git version 1.8.3.4 (Apple Git-47)` nor the server `git version 1.7.1` (in `httpd` error logs) prompted with 'did you run git update-server-info on the server'. – Zach Young Dec 17 '13 at 20:25
2

I confirm you need to create your repo on GitHub first, before being able to push to said (remote) repo.

Once created, you can add it as a remote named 'origin' to your local repo, and 'git push origin master' (for the first push).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • See also http://stackoverflow.com/questions/7311995/what-is-git-push-origin-master-help-with-gits-refs-heads-and-remotes on `git push origin master` bit. – VonC Sep 13 '12 at 13:57
2

I had the same error info/refs not found when I was cloning a local repository and serving it via http.

It seems that cloning a repository doesn't create the info/refs file and therefore it cannot been served remotely (https, ssh etc.) as remotely there is no way to get the name of the master branch without listing the .git folder, so the info/refs provides the path and the commitid for current git repository HEAD .

mkdir clone-without-refs; cd clone-without-refs
git clone ../origin.git .
ls -l .git/info

so I created it by hand this way (in the source repository, assuming you run a /bin/sh type of shell)

gitid=$(git rev-parse  HEAD)
echo HEAD: $gitid
echo -e "$gitid\trefs/heads/master" > .git/info/refs
if [ ! -e .git/refs/heads/master ]; then
    echo $gitid > .git/refs/heads/master
fi

then I did my cloning again and it worked (change $origin with yours):

rm -rf ../cloned
# checking if refs file is there (httpds server side):
origin="http://localhost:8080/~$USER/$(pwd|sed -e "s,$HOME/,,")/.git"
curl $origin/info/refs
git clone $origin ../cloned
# verify
git -C ../cloned log -2
  • 4
    Were you following the "dumb HTTP" scenario from the git book? https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_dumb_http I had the same problem but I found I just had to go to the bare clone and execute `git update-server-info` for git to create `info/refs`. – Rafał Cieślak Mar 25 '21 at 16:32
1

Also note that the repository name is case sensitive. Oops!

kforbesie
  • 33
  • 4
1

Are you sure the git repo you're trying to access supports the HTTPS protocol?

Instead of this: git clone https://github.com/TeaCodie/TeaCodie-Website.git

Try this: git clone git@github.com/TeaCodie/TeaCodie-Website.git

You may need to configure your SSH key.

For some details, see: http://git-scm.com/book/ch4-1.html and https://help.github.com/articles/set-up-git and https://help.github.com/articles/generating-ssh-keys

l3x
  • 30,760
  • 1
  • 55
  • 36
0

The issue I had was due to the fact that the user didn't have write permission on the master branch.

user1369430
  • 33
  • 1
  • 6
0

Also, make sure the repository URL is reachable from your network.

In my case, my internet subscription was close to expiring so my service provider was redirecting all the HTTP/HTTPS calls to their renewal page.

So, GIT could not reach the repository.

mridula
  • 3,203
  • 3
  • 32
  • 55