GitHub API docs says:
Git DB API functions will return a 409 if the git repo for a Repository is empty or unavailable.
My POST on $repo/git/trees returns 409 indeed.
How do I create initial commit in the repository then? Do I have to force user to commit some useless junk manually, just for the sake of creating root commit?
I emailed github support with the same issue and here is their response:
As a workaround, depending on your use case, you may be able to create forks rather than new repos.