几个月后,我没有在一些静态网站工作,我回来了,并试图从一个GitHub回购的变化。
发生以下fatal: bad object refs/heads 2/master
错误。
(base) ➜ github_repo git:(master) ✗ git pull
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 21 (delta 3), reused 3 (delta 3), pack-reused 18
Unpacking objects: 100% (21/21), 6.95 KiB | 790.00 KiB/s, done.
fatal: bad object refs/heads 2/master
error: https://github.com/asafmaman101/asafmaman101.github.io.git did not send all necessary objects
从StackOverflow尝试了一些类似问题的解决方案,并尝试在我的mac上更新Git版本。
什么都帮不上忙。我试图阻止删除本地复制和重新克隆回购,因为我有本地更改,我不想失去。还有其他想法吗?
发布于 2022-08-14 23:25:12
在将“2”后缀添加到.git
目录中的文件名时,我也遇到了类似的问题。git存储库位于由iCloud驱动器同步的目录中,因此想必iCloud在其无限智慧中在同步操作期间添加了后缀。
我最初在SourceTree中通过一个神秘的错误消息遇到了这个问题。在命令行上运行git gc
帮助我缩小了问题范围:
> git gc
fatal: bad object refs/heads/1.2 2
fatal: failed to run repack
我能够通过删除“2”后缀来解决这个问题:
> mv .git/refs/heads/1.2\ 2 .git/refs/heads/1.2
https://stackoverflow.com/questions/72515916
复制相似问题