Using the pygit2 package how do you create an initial commit on a new repository?
I keep getting an error message that "refs/heads/master" isn't found.
Using the pygit2 package how do you create an initial commit on a new repository?
I keep getting an error message that "refs/heads/master" isn't found.
For some context I'm working on a Python module created from the current spaghetti code I use to manage a GitLab instance to post and grade assignments for a university course. Work can be found here. My application requires that I download a repository as a "template" assignment to post for all students so I need to use the same file tree with a new git repository for all students in my course (hence the need to create initial commits over and over again).
The trick here, which I could not find documented anywhere (pygit2's documentation seems to be lacking as of this posting), is to set the first argument to
create_committo"HEAD"rather than, e.g.,"refs/heads/master"as in the example. Perhaps this is obvious to the git wizards out there but it took me a second to realize.I used the following as references: