致命:您是否在服务器上运行 git update-server-info ?- 不使用github
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19345828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fatal: did you run git update-server-info on the server? - Not using github
提问by wdphd
1. I followed the following tutorial to setup git for web development on my private server.
1. 我按照以下教程在我的私人服务器上设置用于 Web 开发的 git。
Im getting the following error while using
我在使用时收到以下错误
git push origin master
fatal: http://mysite.com/.git/info/refs?service=git-receive-packnot found: did you run git update-server-info on the server?
致命:http://mysite.com/.git/info/refs?service=git-receive- packnot found:你在服务器上运行了 git update-server-info 吗?
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.
我跟进了有关 stackoverflow 的各种问题,这些问题都指向在使用 git push 之前创建一个存储库,但我已经有了一个 git 存储库。
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.
2 . 当我访问 mysite.com/.git 时,会显示完整的 .git 存储库。我如何禁用它并只启用 git push 相同。
采纳答案by VonC
A remote url like http://mysite/.git
is certainly not a valid one.
像这样的远程 urlhttp://mysite/.git
肯定不是有效的。
It should refer to a bare repo namelike, from the tutorial you reference, 'myproject/.git':
它应该引用一个裸仓库名称,例如您参考的教程中的“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
).
(替换dan
为您用于在 中设置 git repo 的用户帐户/var/www/myproject
)。
The OP wdphdconfirms it works, but the non-bare repo isn't updated.
该OP wdphd确认它的工作原理,但非裸露的回购没有更新。
That is because the hook is pushing to "hub
", and that remote need to be declared:
那是因为钩子正在推送到“ hub
”,并且需要声明远程:
cd /var/www/myproject/.git
git remote add hub /var/git/myproject.git
(easier than editing /var/www/myproject/.git/config
directly)
(比/var/www/myproject/.git/config
直接编辑容易)