[英]While trying to sync my changes to my repository I get the error "Git: fatal: bad object refs/remotes/origin/main 2"
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.我在 repo 中也没有任何其他分支,所以 main 2 不存在。
As I mentioned before , check in your local repository what is corrupted with:正如我之前提到的,检查您的本地存储库中损坏的内容:
git rev-list --verify-objects --stdin --not --all
And: git fsck
.并且:
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.还要检查您是否可以将存储库克隆回新的本地文件夹,以确保可以再次访问当前推送到 GitHub 的内容。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.