Git pull 没有更新,repo 不一致?

发布于 2024-10-10 06:39:18 字数 1080 浏览 6 评论 0原文

我在 apache2 上使用 DAV 配置 git 时遇到了一个奇怪的问题。

如果需要,我将提供更多详细信息,但这里是问题的高级概述。

我有 3 个存储库克隆:

  1. 一个用于推送和拉取的裸存储库,其中
  2. 一台位于机器 A 上,
  3. 另一台位于机器 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:

  1. the bare one to push and pull from
  2. one on Machine A
  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丢了幸福的猪 2024-10-17 06:39:18

既然您已经在评论中确认了我的猜测是正确的,我将将此添加为答案:) 听起来问题就是这个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文