invalid credential type for any passed RemoteCallback
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with the failing entry points in pygit2/remotes.py and callbacks.py, especially RemoteCallbacks, _credentials_cb, and get_credentials; reproduce the error with the shown Keypair, UserPass, and KeypairFromAgent examples. Trace how credentials are passed during connect or fetch, and consider the issue done when valid credential providers no longer raise TypeError: invalid credential type.
Written by the indexing model from the issue text.
Description
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?
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libgit2/pygit2
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·