Python 克隆 git 存储库的方法

标签 python git module

是否有不使用子进程克隆 git 存储库的 Python 方式?我愿意使用您推荐的任何类型的模块。

最佳答案

使用 GitPython会给你一个很好的 Git 的 Python 接口(interface)。

例如,在安装之后(pip install gitpython),你可以使用clone_from 来克隆一个新的仓库。功能:

from git import Repo

Repo.clone_from(git_url, repo_dir)

GitPython Tutorial有关使用 Repo 对象的示例。

注意: GitPython 需要在系统上安装 git,并且可以通过系统的 PATH 访问。

关于Python 克隆 git 存储库的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2472552/

相关文章:

java - 在 IntelliJ IDEA 中使用模块

python - 计算networkx中节点之间的边

python - 如何快速列出 1~100 的 list ?

python - 读取包含某些日期时间和某些空白的列会导致 Python Pandas 读取为对象而不是日期时间

python - 如何从 aiohttp 中的处理程序运行异步进程

Git 只 pull 一个提交

git - IntelliJ IDEA : List of defined git tags

git:显示来自旧提交的文件的 future

java - 从 JBoss 4.2 迁移时出现 JBoss wildfly 10 NoClassDefFoundError

dynamic - Angular 2(最终): resetConfig to add routes to lazy loaded routes