libgit2 / libgit2/pygit2

invalid credential type for any passed RemoteCallback

Đang mở
#1,278 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
1.7k
Fork
408
Merge trung bình
2 ngày 57 phút
Pull request đã merge (30 ngày)
7

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với các điểm vào đang bị lỗi trong pygit2/remotes.py và callbacks.py, đặc biệt là RemoteCallbacks, _credentials_cb và get_credentials; tái hiện lỗi bằng các ví dụ Keypair, UserPass và KeypairFromAgent được cung cấp. Theo dõi cách thông tin xác thực được truyền trong quá trình connect hoặc fetch, và coi issue là hoàn tất khi các nhà cung cấp thông tin xác thực hợp lệ không còn gây ra TypeError: invalid credential type.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
git, python
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.