简体   繁体   中英

Unable to Commit Git Changes. Error Message: fatal: cannot lock ref 'HEAD': unable to resolve reference 'refs/heads/master': reference broken

I am getting the above error when tryping to commit changes in my repo. git gc returns the following:

error: bad ref for .git/logs/HEAD
error: bad ref for .git/logs/refs/heads/master
error: bad ref for .git/logs/HEAD
error: bad ref for .git/logs/refs/heads/master
error: inflate: data stream error (unknown compression method)
fatal: loose object 3ee0ce38a1503fa8a00412a81ea64965c85d8943 (stored in .git/objects/3e/e0ce38a1503fa8a00412a81ea64965c85d8943) is corrupt
error: failed to run repack

I don't really know how to resolve this sort of thing and other answers I have found to similar questions haven't done the trick.

OK, so the only quick way I could find to fix this was to clone the repo into a different location and then re-make any changes from the other location of the repo. Not really a fix but a work around and took 10 minutes all-in-all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM