如何用python代码克隆git存储库?
我是Git新手。我想克隆我的远程github存储库(git://github.com/eltejaee/BIC2.git)使用python脚本。我知道“dulwich”和“gitpython”很合适,但我无法克隆或使用它们。克隆我的远程github存储库的最佳python代码是什么?github有一个python包装器如何用python代码克隆git存储库?,git,python-2.7,Git,Python 2.7,我是Git新手。我想克隆我的远程github存储库(git://github.com/eltejaee/BIC2.git)使用python脚本。我知道“dulwich”和“gitpython”很合适,但我无法克隆或使用它们。克隆我的远程github存储库的最佳python代码是什么?github有一个python包装器 您可以使用或 如果您只想克隆/拉取,则可以使用系统命令: os.system("git clone ...") os.system("git pull") 如果您也想要命令的输
您可以使用或 如果您只想克隆/拉取,则可以使用系统命令:
os.system("git clone ...")
os.system("git pull")
如果您也想要命令的输出,我建议您使用
对于Github,您可以使用我的解决方案非常简单直接。它甚至不需要手动输入解释/密码 这是我的完整代码:
import os
import sys
path = "/path/to/store/your/cloned/project"
clone = "git://github.com/eltejaee/BIC2.git"
os.system("sshpass -p your_password ssh user_name@your_lhost")
os.chdir(path) # Specifying the path where the cloned project has to be copied
os.system(clone) # Cloning
print "\n CLONED SUCCESSFULLY.! \n"