如何使用GitPython克隆存储库

问题描述 投票:0回答:1

我是Python和Git的新手。找到GitPython库来使用Python运行Git命令。我正在尝试将已创建的Google Cloud私有存储库克隆到Mac上的本地目录。我的代码如下:

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

我收到以下错误:

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

请帮忙。提前致谢。

repository clone git-clone gitpython
1个回答
0
投票

我试图做同样的事情,然后我发现了qazxsw poi,用它我能够用两行克隆一个存储库。

怎么样?首先确保在python环境中安装了pygit2。我使用以下命令行执行了此操作:

pygit2

这里我提到的两行:

pip install pygit2
© www.soinside.com 2019 - 2024. All rights reserved.