克隆 git 存储库的 Python 方法 [英] Python way to clone a git repository
本文介绍了克隆 git 存储库的 Python 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有不用子进程克隆 git 存储库的 Python 方法?我准备使用您推荐的任何类型的模块.
Is there a Python way without using a subprocess to clone a git repository? I'm up for using any sort of modules you recommend.
推荐答案
有 GitPython.之前和内部都没有听说过它,它依赖于在某处放置 git 可执行文件;此外,他们可能有很多错误.但值得一试.
There is GitPython. Haven’t heard of it before and internally, it relies on having the git executables somewhere; additionally, they might have plenty of bugs. But it could be worth a try.
如何克隆:
import git
git.Git("/your/directory/to/clone").clone("git://gitorious.org/git-python/mainline.git")
(这不太好,我不知道这是否是受支持的方法,但确实有效.)
(It’s not nice and I don’t know if it is the supported way to do it, but it worked.)
这篇关于克隆 git 存储库的 Python 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文