invalid credential type for any passed RemoteCallback
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 408
- 平均合并
- 2 天 57 分钟
- 30 天内合并 PR
- 7
描述
pygit2 version: 1.14.1
Python version: 3.10.12
I'm trying to connect to the git server with via a ssh url.
e.g. remote.url is ssh://example.com:22/path/to/repo
When I'm trying to remote.fetch(callbacks=callbacks) (or any other operation like push or connect) I'm getting TypeError: invalid credential type
It doesn't matter which credential provider I pass into the RemoteCallbacks object.
For example:
keypair = pygit2.Keypair("git", "/home/myuser/.ssh/id_rsa.pub", "/home/myuser/.ssh/id_rsa", "")
callbacks = pygit2.RemoteCallbacks(keypair)
or
keypair = pygit2.UserPass("eeee", "xxx")
callbacks = pygit2.RemoteCallbacks(keypair)
or
keypair = pygit2.KeypairFromAgent("git")
callbacks = pygit2.RemoteCallbacks(keypair)
I'm getting always the following stack trace:
File "..../site-packages/pygit2/remotes.py", line 120, in connect
payload.check_error(err)
File "..../site-packages/pygit2/callbacks.py", line 93, in check_error
raise self._stored_exception
File "..../site-packages/pygit2/callbacks.py", line 416, in wrapper
return f(*args)
File "..../site-packages/pygit2/callbacks.py", line 484, in _credentials_cb
ccred = get_credentials(credentials, url, username, allowed)
File "..../site-packages/pygit2/callbacks.py", line 579, in get_credentials
raise TypeError("invalid credential type")
The repository is initialized with repo = Repository(discover_repository("/root/path/of/my/repo"))
With git itself I can do all the operations. So I guess that the settings are correct.
Do you have any idea which does let this operation fail?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 pygit2/remotes.py 和 callbacks.py 中失败的入口点开始,尤其关注 RemoteCallbacks、_credentials_cb 和 get_credentials;使用所示的 Keypair、UserPass 和 KeypairFromAgent 示例重现该错误。跟踪凭据在 connect 或 fetch 期间的传递方式,并在有效的凭据提供程序不再引发 TypeError: invalid credential type 时,视为该 issue 已完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, python
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100