简体   繁体   English

我如何使用Python和PyGithub / GitPython克隆git存储库?

[英]How i can clone my the git repository using Python and PyGithub/GitPython?

Here I was looking around write some code through which I can maintain my git repository. 在这里,我环顾四周编写一些代码,通过这些代码可以维护我的git存储库。

I am python beginners level but i know it. 我是python初学者,但我知道。 My repository on git hub is. 我在git hub上的存储库是。

https://github.com/gtrdotmcs/NewDjango/

I would really like to clone,pull,commit and push my repository using python code. 我真的很想使用python代码克隆,拉动,提交和推送我的存储库。

Yeah it not easy for beginners but I would really like to do it. 是的,对于初学者来说并不容易,但我真的很想这样做。 Coming around i came with some python libraries for github. 到处走走,我为github提供了一些python库。 PyGithub and GitPython PyGithubGitPython

I would also like to know which is better one? 我也想知道哪个更好?

PyGithub is a library for interacting with the GitHub API; PyGithub是一个用于与GitHub API交互的库; it will not let you clone your repository or otherwise interact with a local git repository. 它不会让您克隆存储库或以其他方式与本地git存储库进行交互。

GitPython is a Python interface to git and can be used to clone a remote repository. GitPythongit的Python接口,可用于克隆远程存储库。 In fact, there's an example of exactly that at the beginning of the tutorial to which you have linked. 实际上,在您已链接到的教程的开头,确实有一个示例。

That said, it's not clear from your question exactly what you hope to accomplish -- learning the git commandline interface is an important skill if you're going to be working with GitHub (or git in general). 就是说,从您的问题中尚不清楚您希望完成什么—如果您要使用GitHub(或一般而言, git ),学习git命令行界面是一项重要技能。 While you can probably perform many of the same tasks with GitPython , you are arguably going to be spending much of your time duplicating the existing functionality of the commandline tools. 尽管您可以使用GitPython执行许多相同的任务,但可以说您将花费大量时间来复制命令行工具的现有功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 gitpython 克隆 git 存储库而不与 git 关联? - How to clone a git repository without association with git using gitpython? 我如何等待git clone在GitPython中完成 - How can I wait for a git clone to finish in GitPython 我可以使用远程 git 存储库并且不要通过 GitPython 在本地克隆它吗 - Can I working with remote git repository and don't clone this on local via GitPython 使用具有https凭证的GitPython克隆AWS CodeCommit git存储库 - Clone AWS CodeCommit git repository using GitPython with https credentials GitPython - 如何将'git stash'更改为GitPython存储库? - GitPython — How to 'git stash' changes to a GitPython repository? 如何使用 GitPython 拉取远程存储库? - How can I pull a remote repository with GitPython? 如何使用 python git clone 存储库,并获取克隆过程的进度? - How can I git clone a repository with python, and get the progress of the clone process? 如何使用 Gitpython 从 Git 的特定分支克隆 - How to clone from specific branch from Git using Gitpython 使用 PyGithub 和 Python 将本地 git 存储库推送到用户的远程 git 存储库 - Push local git repository to a user's remote git repository using PyGithub and Python 如何使用 PyGithub 检查给定文件是否存在于 Github 存储库中? - How can I check if a given file is present in a Github repository using PyGithub?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM