How do I push new files to GitHub?

后端 未结 6 890
独厮守ぢ
独厮守ぢ 2020-12-08 22:31

I created a new repository on github.com and then cloned it to my local machine with

git clone https://github.com/usrname/mathematics.git

I

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 22:58

    If PyGithub's documentation is not usable (and it doesn't look so), and you just want to push a commit (not doing anything fancy with issues, repo configuration, etc.), you would probably be better off directly interfacing with git, either calling the git executable or using a wrapper library such as GitPython.

    Using git directly with something such as subprocess.Popen that you mentioned would probably be easier on the leaning curve, but also more difficult in the long term for error handling, etc. since you don't really have nice abstractions to pass around, and would have to do the parsing yourself.

    Getting rid of PyGithub also frees you from being tied to GitHub and its API, allowing you to push to any repo, even another folder on your computer.

提交回复
热议问题