libgit2 / libgit2/pygit2

_pygit2.GitError: authentication required but no callback set

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

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

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

説明

I'm guessing this is an issue on my end, not really an issue with pygit2, but I've been stuck on it for two days with almost no progress and the documentation isn't making sense to me.

I am trying to push to a repository using user name and password credentials and getting the error:

File "createRepo.py", line 72, in remote.push(['refs/heads/master']) File "/usr/local/lib/python2.7/dist-packages/pygit2/remote.py", line 470, in push check_error(err) File "/usr/local/lib/python2.7/dist-packages/pygit2/errors.py", line 64, in check_error raise GitError(message) _pygit2.GitError: authentication required but no callback set

```
#Clone the newly created repo
repoClone = pygit2.clone_repository(repo.git_url, '/var/www/html/uploads/tmp')
print "GIT URL: "
print repo.clone_url
print "<---"

#Add the new files to the repo
for file in files:
    os.rename("/var/www/html/uploads/" + file, "/var/www/html/uploads/tmp/" + file)

#Commit it
repoClone.remotes.set_url("origin", repo.clone_url)
index = repoClone.index
index.add_all()
index.write()
author = pygit2.Signature("MaslowCommunityGardenRobot", "info@maslowcnc.com")
commiter = pygit2.Signature("MaslowCommunityGardenRobot", "info@maslowcnc.com")
tree = index.write_tree()
oid = repoClone.create_commit('refs/heads/master', author, commiter, "init commit",tree,[repoClone.head.get_object().hex])
remote = repoClone.remotes["origin"]
credentials = pygit2.UserPass(userName, password)
remote.credentials = credentials
remote.push(['refs/heads/master'])

The documentation clearly says that there is an optional callback argument push(specs, callbacks=None), but how and when to use that feature is not clear.

If I can get this to work I will post it as a clear, simple example of how to create a repository with pyGitHub, clone it, create a commit, and push it which is something I think is missing.

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

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

はじめの一歩

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

調査の方向性

createRepo.py の 72 行目付近と pygit2 remote.push(specs, callbacks=None) のドキュメントから始め、UserPass の代入と callback API を比較してください。認証に関するガイダンスまたは例が不足しているかを判断し、必要な push の認証フローが明確にドキュメント化または実証された時点で issue は完了とします。

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

評価

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

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

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