Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up a number of private repos where I commit via SSH but I'm having problems setting up a public one. Here's what I've done so far:

Log into my server via ssh

$ cd public_html/repos/
$ mkdir test
$ cd test 
$ git --bare init
$ touch git-daemon-export-ok # tell GIT it's ok to export this project
$ chmod 777 -R ../test #making sure the directory had full read write execute permissions
$ exit # exit out of ssh

$ mkdir test_porject
$ cd test_project
$ touch README.txt
$ git init #Initialized empty Git repository in ~/test_porject
$ git add .
$ git commit -m "initial commit"
$ git remote add origin
$ git push origin master

this is the error I get: error: The requested URL returned error: 500 while accessing fatal: HTTP request failed

Huh???? Not sure why this isn't working. If you go to I don't get any errors. Any help would be much appreciated.

share|improve this question
What do you see in your server error log? This will usually include more detailed information about the 500 error. – larsks Sep 22 '11 at 16:00
Here's what I get: [22/Sep/2011:13:08:36 -0400] "GET /test/info/refs?service=git-receive-pack HTTP/1.1" 500 680 "-" "git/" [22/Sep/2011:13:08:36 -0400] "GET /test/info/refs HTTP/1.1" 500 680 "-" "git/" – jwerre Sep 22 '11 at 17:14
What do you see in your browser if you go to What about just Do either of these work? I'm a little puzzled because you're installing things into your public_html directory, which is often accessed via /~username/, but maybe that's just how your hosting provider does things. – larsks Sep 22 '11 at 21:10
I can access refs just fine in the bowser. I made a subdomain for all my repositories which is located here: /home/usename/public_html/repos. – jwerre Sep 22 '11 at 22:14
I'm currently getting this error $ git clone http://mydomain:[port]/home/username/public_html/repos/test Cloning into test... error: while accessing http://mydomain:[port]/home/username/public_html/repos/test/info/refs – jwerre Sep 26 '11 at 15:34
up vote 1 down vote accepted

I am suspicious that your transcript above does not in fact represent the actual commands that you typed. Here's how you can set up an http-accessible repository, and the commands (and output) here are exactly what I have typed in:

Creating the repository:

$ mkdir -p public_html/git
$ cd public_html/git
$ git init --bare testrepo.git
Initialized empty Git repository in /home/lars/public_html/git/testrepo.git/
$ cd testrepo.git
$ mv hooks/post-update.sample hooks/post-update
$ chmod 755 hooks/post-update

Populating it with some commits:

$ cd ~/tmp/
$ mkdir testrepo
$ cd testrepo
$ git init
Initialized empty Git repository in /home/lars/tmp/testrepo/.git/
$ echo this is a test > myfile
$ git add myfile
$ git ci -m 'added myfile'
[master (root-commit) eea6564] added myfile
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 myfile
$ git remote add origin ~/public_html/git/testrepo.git
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 233 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /home/lars/public_html/git/testrepo.git/
 * [new branch]      master -> master

Cloning it via http:

$ cd ~/tmp
$ git clone http://localhost/~lars/git/testrepo.git testrepo-cloned
Cloning into testrepo...
$ ls -A testrepo-cloned/
.git  myfile

If you run through this and it doesn't work, I strongly suspect an issue with your webserver configuration.

share|improve this answer

$ git remote add origin

$ git push origin master

You are trying to push to an http exposed repository? This won't work.

[..] Anybody else should then be able to clone or pull from that URL [..]

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.