I want to be able to create an initialize the main
branch of a repository without it having any files in it through the Github API. Normally this would be done like so with git
:
git init
git remote add origin <url>
git commit --allow-empty
git push origin main
However with the Github API I am able to easily create the repository but I am unable to commit an empty commit to it. Using the empty tree and committing that only causes the Github API to say that the repository is empty, and then do nothing. Ideally I would like to not have to create a dummy file and then delete it, but that appears to be the only way currently. Please let me know if there is any way to create an empty commit without the use of a dummy file.
tl;dr: Is there any ways to emulate git
's --allow-empty
commit using the Github API?