libgit2 / libgit2/pygit2

invalid credential type for any passed RemoteCallback

オープン
#1,278 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
1.7k
フォーク
408
平均マージ
2日 57分
マージ済み PR(30日)
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?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。