libgit2 / libgit2/pygit2

_pygit2.GitError: authentication required but no callback set

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

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

support
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 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.

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 createRepo.py quanh dòng 72 và tài liệu về pygit2 remote.push(specs, callbacks=None), sau đó so sánh phép gán UserPass với callback API. Xác định xem hướng dẫn hoặc ví dụ về xác thực có bị thiếu hay không, và coi issue là hoàn tất khi quy trình xác thực push bắt buộc đã được tài liệu hóa hoặc minh họa rõ ràng.

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
Tài liệu
Độ 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
25/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.