libgit2 / libgit2/pygit2

Pygit2 cannot parse URLs with OAuth tokens.

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

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

主要言語
Python
スター
1.7k
フォーク
408
平均マージ
2日 57分
マージ済み PR(30日)
7

説明

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

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

pygit2/init.py に示されている clone_repository 呼び出しから始め、URL が errors.py のエラーチェックにどのように到達するかを調べます。OAuth トークン URL のケースを再現し、issue に記載されているコマンドラインの動作と比較して、既存の URL 処理または認証処理のどれが適用されるかを判断します。完了条件は、clone_repository がドキュメントに記載された GitHub トークン URL を Unsupported URL protocol を発生させずに受け入れることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
git, python
領域
authentication, backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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