Git pull无法更新本地参考

Psy*_*888 1 windows git shell cmd

自从我们开始为 git 使用子模块以来,我有一些奇怪的事情。我在 Windows 10 上使用 Tortoise git 或 Powershell 或 cmd 或 Linux 命令解释器。

每当我尝试拉一个子模块时,我都会得到这样的信息:

PS
D:\repositories\git\ProjectAlice\ProjectAliceSkills\PublishedSkills\AliceCore>
git pull error: cannot lock ref 'refs/tags/1.0.35>=1.0.0-a4': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.35>=1.0.0-a4.lock':
Invalid argument From
https://github.com/project-alice-assistant/skill_AliceCore  ! [new
tag]         1.0.35>=1.0.0-a4 -> 1.0.35>=1.0.0-a4  (unable to update
local ref) error: cannot lock ref 'refs/tags/1.0.36>=1.0.0-a5': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.36>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.36>=1.0.0-a5 ->
1.0.36>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.37>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.37>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.37>=1.0.0-a5 ->
1.0.37>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.38>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.38>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.38>=1.0.0-a5 ->
1.0.38>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.39>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.39>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.39>=1.0.0-a5 ->
1.0.39>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.40>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.40>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.40>=1.0.0-a5 ->
1.0.40>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.42>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.42>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.42>=1.0.0-a5 ->
1.0.42>=1.0.0-a5  (unable to update local ref) PS D:\repositories\git\ProjectAlice\ProjectAliceSkills\PublishedSkills\AliceCore>
git pull error: cannot lock ref 'refs/tags/1.0.35>=1.0.0-a4': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.35>=1.0.0-a4.lock':
Invalid argument From
https://github.com/project-alice-assistant/skill_AliceCore  ! [new
tag]         1.0.35>=1.0.0-a4 -> 1.0.35>=1.0.0-a4  (unable to update
local ref) error: cannot lock ref 'refs/tags/1.0.36>=1.0.0-a5': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.36>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.36>=1.0.0-a5 ->
1.0.36>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.37>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.37>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.37>=1.0.0-a5 ->
1.0.37>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.38>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.38>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.38>=1.0.0-a5 ->
1.0.38>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.39>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.39>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.39>=1.0.0-a5 ->
1.0.39>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.40>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.40>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.40>=1.0.0-a5 ->
1.0.40>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.42>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.42>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.42>=1.0.0-a5 ->
1.0.42>=1.0.0-a5  (unable to update local ref)
Run Code Online (Sandbox Code Playgroud)

因此,与锁定的引用有关。令人讨厌的一点是,当我通过 Linux 命令解释器执行相同的 git pull 时,好吧,它只是有效...... Tortoise git、cmd 或 Powershell 因上述错误而失败。

我今天确实更新了 git 以确保,我确实尝试了我在该问题上找到的所有修剪建议,但没有任何解决方案。好吧,使用 Linux 命令解释器然后他们说!好吧,不幸的是,有大量的子模块......

tor*_*rek 5

问题可能出此处的标签名称上

 ! [new tag] 1.0.35>=1.0.0-a4 -> 1.0.35>=1.0.0-a4
Run Code Online (Sandbox Code Playgroud)

这表明,在他们的计算机上(无疑运行 Linux),他们有一个名为 .gitignore 的 Git 标签1.0.35>=1.0.0-a4的计算机上运行的 Git 决定创建一个同名的标签。(这是标签背后的基本思想:与分支名称不同,每个人都应该共享相同的名称。所以如果他们X在他们的 Git 中创建一个标签,你的 Git 会将该标签及其存储的哈希 ID 复制到你的 Git,同时调用它X。将其与分支名称进行比较:如果他们创建了一个名为的分支X,您的 Git 将重命名它并将其命名origin/X。)

为此,您的 Git 会尝试使用此字符串作为文件名的一部分来创建本地文件系统文件。您的计算机出于某种原因拒绝这样做 - 可能拒绝该>角色。见布雷特·卡梅隆的回答什么字符在Windows和Linux的目录名被禁止?

对此的一种解决方案是告诉您的 Git根本不要尝试复制它们的标签:添加--no-tags到您的git fetchgit pull命令中。更好的方法是让您的同事/同事停止在任何名称中使用此类字符。