Reputation: 2569
From the documentation at 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.
Is there a way to check if the fork is completed?
I thought about accessing individual files in the forked repo, but I don't have a large enough repo (that actually takes a long time to fork) to test this on.
Upvotes: 2
Views: 309
Reputation: 18762
You reach out to GitHub support as well, so I'll paste my answer here.
That's a great question. Normally, forking should be done within seconds, but for larger repositories might take a while. One way to know when forking is done (via the API) is to fetch the list of commits for the fork:
https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
If forking is not done yet, you should get back a 409 with this message:
HTTP/1.1 409 Conflict
{
"message": "Git Repository is empty.",
"documentation_url": "https://developer.github.com/v3"
}
When forking is done, you'll get back a 200 OK with a list of commits.
Upvotes: 5