How do I fix “remote: fatal error in commit_refs” errors trying to push with Git?

前端 未结 8 662
情歌与酒
情歌与酒 2021-02-04 23:34

When I try to push to master I get:

remote: fatal error in commit_refs

How can I solve this?

相关标签:
8条回答
  • 2021-02-04 23:47

    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.

    0 讨论(0)
  • 2021-02-04 23:49

    In my case I suspect a hung git process was causing the problem; I killed it and retried and the problem went away.

    0 讨论(0)
  • 2021-02-04 23:51

    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
    
    0 讨论(0)
  • 2021-02-04 23:52

    I raised this with GitHub in relation to http://blastedbio.blogspot.co.uk/2016/05/sync-github-mirror-with-cron.html and it turned out to be due to protected branch settings. GitHub have improved the error message:

    $ 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 git@github.com:HuttonICS/biopython.git
     ! [remote rejected] master -> master (protected branch hook declined)
    error: failed to push some refs to 'git@github.com: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/

    0 讨论(0)
  • 2021-02-04 23:59

    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.

    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).

    0 讨论(0)
  • 2021-02-05 00:05

    In my case, GitHub was down by the time I was trying to push.

    Just check https://www.githubstatus.com/ to know about GitHub site status.

    When it's up you'll be able to push.

    0 讨论(0)
提交回复
热议问题