Git pull 没有更新,repo 不一致?
我在 apache2 上使用 DAV 配置 git 时遇到了一个奇怪的问题。
如果需要,我将提供更多详细信息,但这里是问题的高级概述。
我有 3 个存储库克隆:
- 一个用于推送和拉取的裸存储库,其中
- 一台位于机器 A 上,
- 另一台位于机器 B 上
。我在机器 A 上进行了 1 项最后更改,然后推送了所有更改,并对两台机器进行了拉取。问题是,由于某种原因,我在拉动机器 B 后看不到最后的更改。
也没有任何关于在任何一台机器上领先于远程的消息。
奇怪的部分是:
- 如果我在裸存储库上执行“git log”,则机器 A 的最后更改将在那里
- 。如果我对裸存储库进行另一个克隆,则更改将不会在那里。它只会取决于机器 B 看到的最后更改。
这是服务器配置问题还是git问题?我已经有这个问题好几个月了。
git Branch -a
打印:
Machine A:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Machine B:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
.git/config
对于两者:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = http://<url>/p/home.git
fetch = +refs/heads/*:refs/remotes/origin/*
I have a strange problem with git configured using DAV on apache2.
I'll provide more details, if needed, but here is a high-level overview of the problem.
I have 3 clones of a repository:
- the bare one to push and pull from
- one on Machine A
- one on Machine B
I do 1 last change on Machine A, and I pushed all my changes, and did a pull on both. The problem is, for some reason I don't see my last changes after pulling on Machine B.
There is no message about being ahead of remote on either machine either.
The weird part is:
- If I do a "git log" on the bare repository, the last changes from Machine A will be there
- If I do another clone of the bare repository, the changes won't be there. It will only be up to the last changes that Machine B sees.
Is this a server configuration issue or a git issue? I've had this problem for many months now.
git branch -a
prints:
Machine A:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Machine B:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
.git/config
for both:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = http://<url>/p/home.git
fetch = +refs/heads/*:refs/remotes/origin/*
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
既然您已经在评论中确认了我的猜测是正确的,我将将此添加为答案:) 听起来问题就是这个 git FAQ 中描述的问题:
https://git.wiki.kernel.org/index.php/GitFaq#My_HTTP_repository_has_updates.2C_which_。 27git_clone.27_misses._What_happened.3F
.git/hooks/ 中有一个名为 post-update.sample 的示例挂钩,您可以将其重命名为 post-update 以便自动运行
git update-server-info< /code> 按下后。这会生成哑 HTTP 传输所需的信息。
Since you've confirmed my guess was right in the comments, I'll add this as an answer :) It sounds like the problem is the one described in this git FAQ:
https://git.wiki.kernel.org/index.php/GitFaq#My_HTTP_repository_has_updates.2C_which_.27git_clone.27_misses._What_happened.3F
There's a sample hook called post-update.sample in .git/hooks/ that you can rename to post-update in order to automatically run
git update-server-info
after a push. This generates information needed by the dumb HTTP transport.