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 http://repos.mydomain.com/test
$ git push origin master

this is the error I get: error: The requested URL returned error: 500 while accessing http://repos.mydomain.com/test/info/refs fatal: HTTP request failed

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

link|improve this question
1  
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/1.7.4.1" [22/Sep/2011:13:08:36 -0400] "GET /test/info/refs HTTP/1.1" 500 680 "-" "git/1.7.4.1" – jwerre Sep 22 '11 at 17:14
What do you see in your browser if you go to repos.mydomain.com/test/info/refs? What about just repos.mydomain.com/test? 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
show 2 more comments
feedback

2 Answers

up vote 1 down vote accepted
+50

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.

link|improve this answer
feedback

$ git remote add origin http://repos.mydomain.com/test

$ git push origin master

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

http://book.git-scm.com/4_setting_up_a_public_repository.html

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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