invalid credential type for any passed RemoteCallback
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.7k
- Fork
- 408
- Merge medio
- 2g 57m
- PR unite (30g)
- 7
Descrizione
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?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dai punti di ingresso che falliscono in pygit2/remotes.py e callbacks.py, in particolare RemoteCallbacks, _credentials_cb e get_credentials; riproduci l’errore con gli esempi mostrati di Keypair, UserPass e KeypairFromAgent. Traccia il modo in cui le credenziali vengono passate durante connect o fetch e considera l’issue completata quando i provider di credenziali validi non generano più TypeError: invalid credential type.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- git, python
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100