2

I am new to Git.I want to clone my remote github repository (git://github.com/eltejaee/BIC2.git) with python script.I know that "dulwich" and "gitpython" are suitable but I couldn't clone or pull with them .What is the best python code to clone my remote github repository?

0

3 Answers 3

2

There are several modules you can use git-python or pygit

If you just want to clone/pull then you can use system commands:

os.system("git clone ...")
os.system("git pull")

and if you want the output of the command as well I recommend you to use subprocesses

For Github you can use python-github

Sign up to request clarification or add additional context in comments.

Comments

0

There is a python wrapper for github

https://github.com/jmoiron/python-github

Comments

0

My solution is very simple and straight forward. It doesn't even need the manual entry of paraphrase/password.

Here is my complete code:

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.