風Feng_Yijing_Dao

風Feng_Yijing_Dao

🦋我宁愿能够欣赏自己无法拥有的东西,也不愿拥有自己无法欣赏的东西🦋
twitter
github
bilibili

如何解决git提示error refs/heads/master invalid sha1 pointer xx问题

Reader 公开链接#

如何解决 git 提示_master_invalid_sha1_pointer_xx 问题

操作步骤#

执行检查

git fsck --full --no-dangling

显示

error: Could not read 3badbbe7d5266d88a92a4b2ec4f8ebcfd4d17f89 fatal: bad object refs/heads/master 
fatal: failed to run repack

接着执行

git reflog expire --expire=now --all
git gc --prune=now

执行完上述命令后,若依旧存在该问题,则需要移除该有问题分支
image.png
移除 config 文件中该 branch 配置
移除 HEAD 或 FETCH_HEAD 中该 branch 编号配置
移除 packed-refs 中该 branch 编号配置
若想直接删除该分支,可执行下面命令

git push origin :refs/heads/master

然后执行更新

git fetch

然后接着执行检查

git fsck --full --no-dangling

成功解决该问题

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.