Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid credential type for any passed RemoteCallback #1278

Open
mathisloge opened this issue Feb 13, 2024 · 0 comments
Open

invalid credential type for any passed RemoteCallback #1278

mathisloge opened this issue Feb 13, 2024 · 0 comments

Comments

@mathisloge
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant