远程:致命错误:解包后仍有未解决的增量差异。

5

我正在使用Windows环境,我有一个远程的Git代码库在网络上。 这是如何创建的:

git init --bare

我将项目克隆到本地后,可以在其上进行提交和推送。 但是某个时刻,我无法再推送了,出现了以下错误:

Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (21/21), 1.93 KiB | 0 bytes/s, done.
Total 21 (delta 15), reused 0 (delta 0)
remote: error: object directory /SERVER/Apps/myApp.git/objects does not exist; check .git/objects/info/alternates.
remote: fatal: unresolved deltas left after unpacking
error: unpack failed: unpack-objects abnormal exit
To //SERVER/Apps/myApp.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '//SERVER/Apps/myApp.git'

所以我尝试创建另一个仓库,结果发生了同样的事情...

你有什么头绪这个错误是如何发生的,以及如何修复它吗?谢谢。

编辑

core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
user.name=Flim
user.email=flim@myMail.com
alias.tree=log --oneline --decorate --all --graph
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=//SERVER/Apps/myApp.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

/SERVER/Apps/myApp.git/objects 应该是 /SERVER/Apps/myApp/.git/objects,不是吗?也许某个配置或路径设置有误了? - jbu
我很好奇 "git config -l" 的输出是什么。 - jbu
1
路径/SERVER/Apps/myApp.git/objects是正确的并且存在,但我想知道路径开头是否缺少一个斜杠? - fliim
我相信你的怀疑是正确的:Git假定//a/b/c/a/b/c意思相同,因此简化掉了额外的/。但在你的操作系统上,这个额外的/实际上并不是多余的。POSIX将多个前导斜杠的行为留给底层操作系统处理,大多数Unix/Linux系统会丢弃额外的斜杠,但Windows可能会使用它来表示“遍历超出根文件系统到一个超级根,从中可以访问网络驱动器”。如果Git假定Linux的行为,你必须使用其他语法,这样Git就不会简化掉必要的字符。 - torek
谢谢。我之前成功推送了我的提交,所以我想这不是问题所在。 - fliim
1个回答

9
非常接近了!这个问题将在即将发布的Git 2.12中解决(2017年第一季度)。详见“Git push fail to a Windows share”。

normalize_path_copy() 方法无法保留//server/share/dir类型路径的双斜杠,而是像处理普通的POSIX路径一样转换成/server/share/dir

因此始终只有第一次可以正常工作,然后错误路径会被注册并且后续就无法再工作了。
现在的解决方案是尝试将共享路径映射到一个驱动器号上。
net use z: \\SERVER\Apps

看看 "Map network drive command line"。 然后将该路径用作您的远程 origin url。
cd C:\path\to\my\local\repo
git remote set-url origin Z:\myApp.git

非常感谢。你的回答清晰简洁,而且解决方法完美奏效。 - fliim
你能否只是在路径前加上 file: 前缀呢?例如 file://server/shar/dir - Souleste
1
@Souleste 是的,这两种语法都可以工作。例如在这里中所示,file:////server/shared/dir,正如本地协议中所解释的那样。 - VonC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接