在 Mac 上的 git 中创建合法分支可防止 Windows 进一步拉取

发布于 2025-01-17 09:01:21 字数 329 浏览 3 评论 0原文

假设我在Mac

git Checkout prn

上创建了一个带有法定名称“ PRN”的分支,我进行了一些更改,提交和推动。没问题。我团队中使用Windows的其他人会遇到相同的存储库遇到错误:

无法锁定Ref'refs/promtes/orient/prn'prn'prn ....-> Origin/PRN(无法更新本地参考)

此错误的大多数帖子推荐

git gc -prune =现在 git Remote Prune Origin

但是,这并不能解决错误。

Suppose I create a branch with a legal name "prn" on a Mac

git checkout prn

I make some changes, commit and push. No problem. Someone else on my team who uses Windows pulls this same repository encounters the error:

cannot lock ref 'refs/remotes/origin/prn' prn .... -> origin/prn (unable to update local ref)

Most posts on this error recommend

git gc --prune=now
git remote prune origin

However, this did not solve the error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

§对你不离不弃 2025-01-24 09:01:21

Windows 有一个保留命名空间列表,阻止 git 在 ./.git/refs/remotes/origin 创建文件“prn”。为了解决这个问题,我们的团队从 Mac 计算机上删除了该分支:

git branch -d prn
git push -d origin prn

然后,我们在两台计算机(Mac 和 Windows)上清除了对此分支的引用

git gc --prune=now
git remote prune origin

最后一行将在 Windows 计算机上抛出错误,指出该分支不存在,这很好。此后我们就可以在 Windows 端正常运行了。

Windows has a list of reserved namespaces that preclude git from creating the file "prn" at ./.git/refs/remotes/origin. To solve this, our team deleted the branch from the Mac computer:

git branch -d prn
git push -d origin prn

We then cleaned up references to this branch on both computers (Mac and Windows)

git gc --prune=now
git remote prune origin

The last line will throw an error on the Windows machine stating that branch doesn't exist, which is fine. We were able to pull on the Windows side no problem after this.

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