Found out about the Github Database API and successfully managed to commit multiple files in one go! It only took six hours or so ;-) The most important lesson is to disable the cache on all GET requests as otherwise, you can get stale data.

Git database

and also this article: Commit a file with the GitHub API

And it is never stated clearly but this also works recursivly for files in subfolders.