我正在尝试提交更改到我的代码库,但是收到下面的错误:
git -c diff.mnemonicprefix=false -c core.quotepath=false commit -q -F C:\Users\Contronym\AppData\Local\Temp\bkdweixb.mnu
fatal: cannot lock ref 'HEAD': unable to resolve reference HEAD: Invalid argument
Completed with errors, see above.
我正在使用Bitbucket和SourceTree。
这次提交失败的原因是什么?在过去的一周里,我已经成功地提交了最近的3个版本。突然间,我收到了这个错误提示。
编辑
我运行了git gc
,以下是结果:
$ git gc
error: bad ref for HEAD
error: bad ref for HEAD
error: inflate: data stream error (unknown compression method)
fatal: loose object 53b65bd9b4fec7f6a7b0b3313c68199a18804327 (stored in .git/objects/53/b65bd9b4fec7f6a7b0b3313c68199a18804327) is corrupt
error: failed to run repack
我检查了目录.git/objects/53/b65bd9b4fec7f6a7b0b3313c68199a18804327
,但是它不存在。那里有另外两个文件,但是b65bd9b4fec7f6a7b0b3313c68199a18804327
不存在。
git fsck --full
命令。还可以参考 https://dev59.com/smIj5IYBdhLWcg3wcEqI#20264177。 - hjpotter92echo ref: refs/heads/master >.git/HEAD
重新创建它。 - Rohan Khudegit symbolic-ref HEAD refs/heads/master
获取 GitHub 的更新版本。 - Rohan Khude