libgit2 / libgit2/pygit2

Pygit2 cannot parse URLs with OAuth tokens.

Đang mở
#554 8 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ả

I'm trying to use pygit2 to clone a GitHub repo using OAuth tokens.
This actually works well from the command line, as explained on GitHub's blog here.

So, I do:

from pygit2 import clone_repository

oauth_token = 'somesuperlongtokengivenbygithub'
repo = clone_repository(
                'https://'+oauth_token+'@github.com/openwrt/luci', 
                '/tmp/repos', 
                bare=True
)

and I get back:

00:04:42 _pygit2.GitError: Unsupported URL protocol
Traceback (most recent call last):
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/rq/worker.py", line 558, in perform_job
    rv = job.perform()
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/rq/job.py", line 495, in perform
    self._result = self.func(*self.args, **self.kwargs)
  File "/home/ubuntu/repo/etincelle/routes.py", line 41, in clone_all_repos
    clone(repo, _app, token)
  File "/home/ubuntu/repo/etincelle/routes.py", line 25, in clone
    clone_repository(oauth_url, git_id_repo, bare=True)
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/pygit2/__init__.py", line 293, in clone_repository
    check_error(err)
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
_pygit2.GitError: Unsupported URL protocol
Traceback (most recent call last):
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/rq/worker.py", line 558, in perform_job
    rv = job.perform()
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/rq/job.py", line 495, in perform
    self._result = self.func(*self.args, **self.kwargs)
  File "/home/ubuntu/repo/etincelle/routes.py", line 41, in clone_all_repos
    clone(repo, _app, token)
  File "/home/ubuntu/repo/etincelle/routes.py", line 25, in clone
    clone_repository(oauth_url, git_id_repo, bare=True)
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/pygit2/__init__.py", line 293, in clone_repository
    check_error(err)
  File "/home/ubuntu/.venv/etincelle/lib/python3.4/site-packages/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
_pygit2.GitError: Unsupported URL protocol

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 lệnh gọi clone_repository được hiển thị trong pygit2/init.py và kiểm tra cách URL đi đến bước kiểm tra lỗi trong errors.py. Tái hiện trường hợp URL có OAuth token, so sánh với hành vi trên dòng lệnh được mô tả trong issue và xác định cơ chế xử lý URL hoặc xác thực hiện có nào được áp dụng. Được xem là hoàn tất khi clone_repository chấp nhận URL GitHub token được ghi trong tài liệu mà không phát sinh Unsupported URL protocol.

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
authentication, backend
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
Khá rõ ràng
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.