After a few month not working on some static website, I came back and tried to pull changes from a GitHub repo.
The following fatal: bad object refs/heads 2/master
error occured.
(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
Tried some solutions for similar problems here from StackOverflow and tried also to update Git version on my mac.
Nothing helped. I'm trying to prevent from deleting local copy and re-cloning the repo because I have local changes that I don't want to lose. Any other ideas?
git ls-remote
to see if there is such a refrefs/heads 2/master
. If there is, it should be removed.refs/heads/master
but no2/master
. I suppose that might be the problem - how should I fix it?.git/refs
directory. Is there aheads
and also aheads 2
? If so, this looks like something done by Dropbox or iCloud. You're going to have to resolve it manually, and also stop storing.git
directories in cloud-managed spaces.