确保你的代码库在线。
今天我在试图向Github推送时遇到了这个错误,甚至无法浏览该网站,只能看到他们的独角兽错误信息。
git pull origin master -r
然后再次将其推送:
git push origin master
我向GitHub提出了与http://blastedbio.blogspot.co.uk/2016/05/sync-github-mirror-with-cron.html相关的问题,结果发现是由于受保护的分支设置。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 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'
根据我的经验,在 GitHub 上进行大规模推送数十个巨型仓库时,现在(2019年)存在一些速率限制,这会导致出现问题。在某些情况下,这也可能导致“无法读取”的问题。
当每次推送之前延迟30秒,这两个问题都会消失,我可以继续处理数百个仓库而不会出现任何问题(唉,别问我为什么)。
注:Original Answer翻译成"最初的回答"
打开一个新的终端并尝试,这对我有效。
对我来说可能与停机有关。需要注意的是,“停机”这个词有点含义。我可以进入GitHub,拉取并执行许多操作。我刚刚从多个其他存储库创建了一个新的repo,并删除了一些内容,更改了gitignore,更改了许多其他内容,但垃圾收集正在文件上进行。
我想我做了太多的更改,某些东西被损坏了,所以我创建了一个新的repo,并将清理后的代码库移动到新的repo中。
但现在,在github.com网站上无法创建新的repo。它在检查repo名称的可用性时锁定,并停留在那里。
倾向于认为GitHub在其API的某个部分存在问题。
补充说明:刚要发布这个回复时,老板娘走进来打扰了我10分钟。服务器创建了新的存储库 100%,现在更新也没有问题了。所以解决方法就是被你的老板娘打断。
(导致无法在 GitHub 网站上创建新存储库的原因可能是负责接受提交的 API 的同一部分存在问题。)
(第二个要点是,在问题出现前后我一直在 GitHub 上工作,所以我对它的停机时间非常敏感,应该大约有 10 分钟左右。所以喝杯咖啡然后再试一次吧。)
附录 2:现在 git gc 也可以正常运行了。之前一直报错:"Unlink of file '.git/objects/pack/pack-cb81eff540c758d04bc7991edbab036cc1bc5211.pack' failed.",多次尝试 gc 都是如此。现在没有错误了。猜测这可能与服务器有关。
git pull origin master
git push origin master