sakshi sakshi - 9 months ago 80
Python Question

How to clone a git repo using python?

I am looking for equivalent way to clone a repo in python

clone_start=`date +%s%N` && git clone --quiet ssh://$USER@$host:29418/git_performance_check >& /dev/null && c
lone_end=`date +%s%N`
Time_clone=`echo "scale=2;($clone_end - $clone_start) / 1000000000" | bc`

How can I do it ?


You can use GitPyhton lib

Clone from existing repositories or initialize new empty ones:

import git
host = 'github'
user = 'root'
git.Git().clone("ssh://{0}@{1}:29418/git_performance_check".format(user, host))