3

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?

2
  • 1
    You could just use git clone <url>? Commented Nov 30, 2019 at 6:10
  • you have to make your repository public or else share the repository with them Commented Nov 30, 2019 at 7:12

2 Answers 2

4

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")
Sign up to request clarification or add additional context in comments.

Comments

3

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")

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.