【发布时间】:2015-06-08 18:58:41
【问题描述】:
我正在尝试使用 ssh 链接从存储中克隆存储库。我收到一条错误消息,提示需要身份验证,这不需要用户名和密码。如何解决此错误?
from pygit2 import *
repo_name = "ssh://git@stash:TheProject"
clone_repository(self.repo_name, self.repo_dir, credentials=cred)
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__ return self.func(*args)
File "rio_telem_tool.py", line 143, in build clone_repository(self.repo_name, self.repo_dir)
File "/usr/local/lib/python2.7/dist-packages/pygit2/__init__.py", line 265, in clone_repository check_error(err)
File "/usr/local/lib/python2.7/dist-packages/pygit2/errors.py", line 56, in check_error raise GitError(message)
GitError: authentication required but no callback set
【问题讨论】:
-
您能否使用
git clone从命令行成功克隆该存储库而不提示输入密码? -
ssh 总是需要用户名和密码。您在 url 本身中提供用户名。 git 生成 ssh 命令,它将查看配置和 ssh 代理,而 libgit2 不会,您需要准确告诉它您要使用哪种身份验证。