Home > OS >  While trying to sync my changes to my repository I get the error "Git: fatal: bad object refs/r
While trying to sync my changes to my repository I get the error "Git: fatal: bad object refs/r

Time:01-07

While trying to sync my changes to my repository I get the error

fatal: bad object refs/remotes/origin/main 2 error: https://github.com/username/repository.git did not send all necessary objects

I also don't have any other branches in the repo, so main 2 doesn't exist.

CodePudding user response:

As I mentioned before, check in your local repository what is corrupted with:

git rev-list --verify-objects --stdin --not --all

And: git fsck.

Check also if you can clone the repository back in a new local folder, to make sure what is currently pushed to GitHub can be accessible again.
If you can clone it, then you can import your local commit in it and push back.

But if this is an extra incorrect branch, check the branch list with:

git branch -avv
  • Related