我正在尝试将更改提交到我的存储库,但是我收到以下错误:
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不存在。
发布于 2018-10-16 09:29:42
在工作副本中使用根用户调用git命令后,我也遇到了同样的问题。因此. .git/下的各种文件的所有者和所有者组被更改为"root“。
当我切换回我的用户帐户时,由于缺乏权限,git无法再处理这个文件。
重新设置权限之后,它再次工作。
sudo chown -R [MY_USER]:[MY_GROUP] .githttps://stackoverflow.com/questions/39057962
复制相似问题