Reputation: 113
I want to allow user to clone the github repository by providing the url of the repository on their system. I found the api but it didnot work without github credentials. Is their any other way from which i can clone the repository with python without providing the github credentials?
Upvotes: 3
Views: 6188
Reputation: 871
Checkout this library gitpython - https://gitpython.readthedocs.io/en/stable/
And below is an example to help you clone
import git
git.Git("/your/directory/to/clone").clone("git://gitorious.org/git-python/mainline.git")
Upvotes: 3
Reputation: 844
You will have to generate Git SSH key Then you can do something like this:
import os
os.system("GIT_SSH_COMMAND=\"ssh -i <insert your git private key here>\" git clone ssh://[email protected]/<username>/<repo>.git")
Upvotes: 4