【问题标题】:fatal: did you run git update-server-info on the server? - Not using github致命的:你在服务器上运行了 git update-server-info 吗? - 不使用 github
【发布时间】:2013-10-21 04:02:11
【问题描述】:

1。 我按照以下教程在我的私人服务器上设置 git 以进行 Web 开发。

Using git for Deployment

我在使用时遇到以下错误

git push origin master

致命:http://mysite.com/.git/info/refs?service=git-receive-pack 未找到:您是否在服务器上运行了 git update-server-info?

我回答了有关 stackoverflow 的各种问题,这些问题都指向在使用 git push 之前创建存储库,但我已经有一个 git 存储库。

2 .当我访问 mysite.com/.git 时,会显示完整的 .git 存储库。我如何禁用此功能并仅启用 git push 到相同的功能。

【问题讨论】:

标签: git push web-deployment web-development-server


【解决方案1】:

http://mysite/.git 这样的远程 URL 肯定不是有效的。

它应该引用一个裸仓库 name,例如,从您引用的教程中,'myproject/.git':

git remote set-url origin dan@server:/var/git/myproject.git

(将dan 替换为您在/var/www/myproject 中用于设置git repo 的用户帐户)。


OP wdphd 确认它可以工作,但非裸 repo 没有更新。

那是因为钩子正在推送到“hub”,并且需要声明那个远程:

cd /var/www/myproject/.git
git remote add hub /var/git/myproject.git

(比直接编辑/var/www/myproject/.git/config 更容易)

【讨论】:

  • 感谢这工作!我对本地服务器进行了一些更改并将其推送到我的私人服务器。但是这些变化仍然没有体现出来。
  • @wdphd 可能是因为您正在推送到非裸仓库,这是不推荐的。您需要在服务器目标存储库中 git checkout master 以使其工作树自行更新。
  • @wdphd 了解为什么非裸回购不通过推送更新:stackoverflow.com/a/3761891/6309。关于裸回购:gitolite.com/concepts/bare.html
  • 不,我没有推入非裸回购。来自 tut: $ cd /var/git/myproject.git $ git init --bare $ cd /var/www/myproject $ git push /var/git/myproject.git master
  • @wdphd 那么在裸仓库中看不到任何文件似乎很正常。 post-update 钩子应该更新非裸仓库。确保它是可执行的 (chmod 755)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-27
  • 2011-04-09
  • 2021-02-26
  • 1970-01-01
相关资源
最近更新 更多