确定分叉是否准备就绪

Determine if a fork is ready

来自 https://developer.github.com/v3/repos/forks/

的文档
Forking a Repository happens asynchronously. Therefore, you may have to 
wait a short period before accessing the git objects. If this takes longer than 
5 minutes, be sure to contact Support.

有没有办法检查分叉是否完成?

我考虑过访问分叉回购中的单个文件,但我没有足够大的回购(实际上需要很长时间才能分叉)来测试它。

您也联系了 GitHub 支持人员,所以我会在此处粘贴我的回答。


这是一个很好的问题。通常,分叉应该在几秒钟内完成,但对于较大的存储库可能需要一段时间。知道分叉何时完成的一种方法(通过 API)是获取分叉的提交列表:

https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository

如果分叉尚未完成,您应该返回 409 并显示以下消息:

HTTP/1.1 409 Conflict

{
  "message": "Git Repository is empty.",
  "documentation_url": "https://developer.github.com/v3"
}

分叉完成后,您将返回带有提交列表的 200 OK。