0

This is my first experience using PyGitHub. I have written code to update my repo using repo.create_file, repo.update_file and repo.delete_file, but after execution, these changes are not reflected in GitHub.

When using git from the command line I have to stage the file using "git add" and "git rm" and then use "git commit" to commit the changes then "git push" to push the changes to the remote URL.

There must be similar things to "git commit" and "git push" that must take place with PyGitHub, but I am unable to figure out what they are. Every example I have seen ends with create_file, update_file, or delete_file.

What am I missing?

Cyberclops
  • 311
  • 2
  • 17
  • This question seems to be entirely about the PyGithub library (which uses the GitHub v3 API, according to its tag info). So the [tag:python] and [tag:git] tags would seem inappropriate here. The [tag:github] one would make sense if your question was about the GitHub v3 API itself. – torek Jun 15 '21 at 14:43
  • Scanning through the PyGithub library, it looks like you could create blob objects, then create tree objects, then create a new commit, then ask to update a ref. That (used properly: the tree object creation is nontrivial) would be the equivalent of `git add` and `git commit`. I'm not sure what the v3-API "create file" endpoint really does, but logically, it probably does all of those for you (on GitHub directly). That is, you'd get one commit per file. (Which ref, if any, gets updated, I have no idea. Maybe you still have to do that yourself.) – torek Jun 15 '21 at 14:58
  • @torek, Thanks for the feedback. Sorry about the tags. – Cyberclops Jun 15 '21 at 18:01

0 Answers0