pushing failed: failed to parse supported auth schemes

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
git, javascript, node.js
Lĩnh vực
authentication

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi trong Remote.push bằng credentials callback và môi trường được báo cáo gồm Node v12.16.3, Windows và nodegit 0.26.5. So sánh các lỗi với mật khẩu không rỗng và mật khẩu rỗng, sau đó lần theo đường dẫn xác thực của push; được xem là hoàn tất khi các push lên GitLab hoàn tất thành công bằng documented credentials flow.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

System information

  • node version: v12.16.3
  • npm or yarn version: 6.14.4
  • OS/version/architecture: win32/10.0.19041/x64
  • Applicable nodegit version: 0.26.5

I am working on a script that clones a repo from gitlab, does some changes and the commits ans pushes these changes back to the repo.
The gitlab url is https://gitlab.com/*my_name*/*repo_name*.git.
Cloning and commiting works but I am unable to push the commit.

This is my code:

const repo = await nodegit.Clone(...)

// do changes 

const index = await repo.refreshIndex();
await index.addAll();
await index.write();
const oid = await index.writeTree();
const head = await nodegit.Reference.nameToId(repo, "HEAD");
const parent = await repo.getCommit(head);

const author = nodegit.Signature.now('*my_name*',
  '*my@emailaddress*');

const commitid = await repo.createCommit("HEAD", author, author, "test message", oid, [parent]);
const commit = await repo.getCommit(commitid);
console.log(commit.message(), commit.author().name(), commit.date()); // <- logs correct data

const remote = await repo.getRemote('origin');
try {
  const pushed = await remote.push(
    ["refs/heads/master:refs/heads/master"],
    {
      callbacks: {
        credentials: function(url, userName) {
          return nodegit.Cred.userpassPlaintextNew('*my_name*', '*my_password*')
        }
      }
    }
  );
} catch (e) {
  console.log(e);
}
[Error: failed to parse supported auth schemes: The operation identifier is not valid.
] {
  errno: -1,
  errorFunction: 'Remote.push'
}

while messing around I found that leaving the password empty causes a different error:

return nodegit.Cred.userpassPlaintextNew('*my_name*', '') // <- empty string
[Error: too many redirects or authentication replays] {
  errno: -1,
  errorFunction: 'Remote.push'
}

I thought this should cause an unauthorized error.

Ngôn ngữ chính
JavaScript
Star
5.8k
Fork
704
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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.

Issue khác của nodegit/nodegit

Tất cả issue của nodegit/nodegit

Issue tương tự

Thêm issue về JavaScript

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.