如何修复尝试使用 Git 推送的“远程:commit_refs 中的致命错误”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37341960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I fix "remote: fatal error in commit_refs" errors trying to push with Git?
提问by Tomas Skogberg
When I try to push to master I get:
当我尝试推动掌握时,我得到:
remote: fatal error in commit_refs
远程:commit_refs 中的致命错误
How can I solve this?
我该如何解决这个问题?
回答by vicke4
In my case, GitHub was down by the time I was trying to push.
就我而言,当我尝试推送时,GitHub 已关闭。
Just check https://www.githubstatus.com/to know about GitHub site status.
只需查看https://www.githubstatus.com/即可了解 GitHub 站点状态。
When it's up you'll be able to push.
到了就可以推了。
回答by Tomas Skogberg
This fixed it for me:
这为我修复了它:
git gc
That will start a garbage collection that resolved my error.
这将启动解决我的错误的垃圾收集。
回答by sirclesam
Make sure your repo is online.
确保您的回购在线。
I got this error today when attempting to push to github and then couldn't even browse the site without getting their unicorn error message.
我今天在尝试推送到 github 时遇到了这个错误,然后在没有收到他们的 unicorn 错误消息的情况下甚至无法浏览该站点。
回答by peterjc
I raised this with GitHub in relation to http://blastedbio.blogspot.co.uk/2016/05/sync-github-mirror-with-cron.htmland it turned out to be due to protected branch settings. GitHub have improved the error message:
我就http://blastedbio.blogspot.co.uk/2016/05/sync-github-mirror-with-cron.html向 GitHub 提出了这个问题,结果证明是由于受保护的分支设置。GitHub 改进了错误信息:
$ git push mirror master
Counting objects: 391, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (391/391), done.
Writing objects: 100% (391/391), 99.28 KiB | 0 bytes/s, done.
Total 391 (delta 298), reused 0 (delta 0)
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: You're not authorized to push to this branch. Visit https://help.github.com/articles/about-protected-branches/ for more information.
To [email protected]:HuttonICS/biopython.git
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to '[email protected]:HuttonICS/biopython.git'
If you try again now you ought to get a more constructive error report. In my case I needed to adjust my protected branch settings as per https://help.github.com/articles/about-protected-branches/
如果你现在再试一次,你应该得到一个更有建设性的错误报告。在我的情况下,我需要根据https://help.github.com/articles/about-protected-branches/调整我的受保护分支设置
回答by kenorb
Try rebase the current branch on top of the upstream branch after pull, e.g.
拉动后尝试将当前分支重新设置在上游分支的顶部,例如
git pull origin master -r
then push it again:
然后再推一下:
git push origin master
回答by Fellow Stranger
Pulling down latest code from the branch solved it for me:
从分支中提取最新代码为我解决了这个问题:
git pull origin master
git push origin master
回答by rakslice
In my case I suspect a hung git process was causing the problem; I killed it and retried and the problem went away.
就我而言,我怀疑是挂起的 git 进程导致了问题;我杀了它并重试,问题就消失了。
回答by kubanczyk
From my experience, there is now (2019) some rate limit on GitHub that causes this problem for me when mass-pushing tens of huge repositories. It can also cause "cannot read" problem in random cases.
根据我的经验,现在(2019 年)GitHub 上有一些速率限制,当批量推送数十个巨大的存储库时,这对我造成了这个问题。在随机情况下,它还可能导致“无法读取”问题。
When I delay for 30 seconds before each push, both problems go away and I can continue with hundreds of repos without a glitch (sigh, don't even ask).
当我在每次推送前延迟 30 秒时,两个问题都会消失,我可以继续处理数百个 repos 而不会出现故障(叹气,甚至不要问)。