0

I am new to Python and Git. Found GitPython library to run Git commands using Python. I am trying to clone an already created private repository on Google Cloud to my local directory on Mac. My code is as follow:

repo = Repo.clone_from('https://source.developers.google.com/p/my-project/r/my-project--data', 'my-local-dir', no_checkout=True)

And I am getting following error:

git.exc.GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git clone --no-checkout -v https://source.developers.google.com/p/my-project/r/my-project-data /my-local-dir stderr: 'Cloning into '/my-local-dir'... fatal: could not read Username for 'https://source.developers.google.com': Device not configured

Please help. Thanks in advance.

1 Answer 1

1

I was trying to the same thing, then I discoverd pygit2, and with it I was able to clone a repository using two lines.

How? First make sure you have installed pygit2 in your python environment. I did that using the following command line:

pip install pygit2

Here the two lines I mentioned above:

import pygit2
pygit2.clone_repository("https://github.com/libgit2/pygit2", "pygit2")
Sign up to request clarification or add additional context in comments.

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.