libgit2 / libgit2/pygit2

Unable to push to remote after committing files

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

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

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

説明

I am committing some files using pygit2 and want to push to remote branch.
This is what i am doing:

        repo = pygit2.Repository(build_dir)
        branch = repo.lookup_branch(local_branch)
        repo.checkout(branch)
        for fl in files:
           repo.index.add(fl)
        repo.index.write()
        message = f"Commiting files {files}"
        tree = repo.index.write_tree()
        parent, ref = repo.resolve_refish(refish=repo.head.name)
        author = pygit2.Signature("user", "email")
        commiter = pygit2.Signature("user", "email")

        repo.create_commit(
            ref.name,
            author,
            commiter,
            message,
            tree,
            [parent.oid],
        )



        remote = repo.remotes["origin"]
        callbacks = pygit2.RemoteCallbacks(pygit2.UserPass("username", GITHUB_PERSONAL_ACCESS_TOKEN))
        remote.push(['refs/heads/master'],callbacks=callbacks)

And i get an error:
_pygit2.GitError: unsupported URL protocol

I cannot find any documentation or any clarity on whats going on here.

Any help will be much appreciated.

thanks

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

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

はじめの一歩

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

調査の方向性

まず、リポジトリに設定されている origin URL と remote.push の呼び出しを調べ、次に、提供された RemoteCallbacks と UserPass の認証情報がどのように使用されているかを確認します。示されている pygit2 コードで未対応の URL プロトコルエラーを再現し、remote の設定を対応しているプロトコルと比較します。設定または callback の問題を特定し、検証済みの push 成功を文書化できれば完了です。

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

評価

技術スタック
git, python
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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