我已经build立了一些私人回购站,我通过SSH提交,但我有问题设置公共的问题。 以下是我迄今为止所做的:
通过SSHlogin到我的服务器
$ 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
这是我得到的错误:错误:请求的URL返回错误:500时访问http://repos.mydomain.com/test/info/refs致命:HTTP请求失败
咦???? 不知道为什么这不起作用。 如果你去http://repos.mydomain.com/我没有得到任何错误。 任何帮助将非常感激。
我怀疑你上面的抄本实际上并不代表你input的实际命令。 以下是如何设置一个http可访问的存储库,这里的命令(和输出)正是我input的内容:
创build存储库:
$ 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
用一些提交填充它:
$ 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
通过http:
$ cd ~/tmp $ git clone http://localhost/~lars/git/testrepo.git testrepo-cloned Cloning into testrepo... $ ls -A testrepo-cloned/ .git myfile
如果你通过这个运行,它不工作,我强烈怀疑你的networking服务器configuration的问题。
$ git remote add origin http://repos.mydomain.com/test
$ git push origin master
您正在尝试推送到http暴露的存储库? 这是行不通的。
http://book.git-scm.com/4_setting_up_a_public_repository.html
[…]其他任何人都应该能够克隆或从该URL 拉 .. [..]