Issue fetching submodules with credentials callback
Maintainer thường phản hồi trong vòng 1 ngày
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
- 42/100
Hướng nghiên cứu
Bắt đầu với luồng đã tái hiện bằng cách sử dụng RepoBuilder::clone, RemoteCallbacks::credentials, SubmoduleUpdateOptions::new, update_opts.fetch và submodule.update. So sánh cách callback được truyền trong quá trình clone với cách các lần cập nhật submodule thực hiện fetch, sau đó xác nhận rằng callback cho SSH key được áp dụng và việc cập nhật submodule hoàn tất mà không có lỗi “no callback set”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Initialising and updating submodules fails when trying to authenticate via SSH key using the credentials callback. From the error message it seems as though setting the callback to pass to libgit2 doesn't actually get passed over? Either that or this is a libgit2 issue.
Details
Setting a callback with an SSH key credential for cloning the repo works correctly. But after cloning the repo and trying to initialise plus update the submodules, with a credential calllback identical to the one for cloning the repo, the following error occurs:
Error { code: -16, klass: 34, message: "remote authentication required but no callback set" }
Code snippet example to replicate issue:
let state = RefCell::new(State::default());
let mut cb = RemoteCallbacks::new();
cb.transfer_progress(|stats| {
let mut state = state.borrow_mut();
state.progress = Some(stats.to_owned());
state.display();
true
});
cb.credentials(|_url, username_from_url, _allowed| {
Cred::ssh_key(
username_from_url.unwrap_or("git"),
None,
ssh_key_path, // Relevant ssh key located in .ssh directory
None,
)
});
let mut co = CheckoutBuilder::new();
co.progress(|path, cur, total| {
let mut state = state.borrow_mut();
state.path = path.map(Path::to_path_buf);
state.current = cur;
state.total = total;
state.display();
});
let mut fo = FetchOptions::new();
fo.remote_callbacks(cb);
let repo = RepoBuilder::new()
.fetch_options(fo)
.with_checkout(co)
.branch("develop")
.clone(
repo_url,
Path::new("/tmp/test-git2/"),
)?;
for mut submodule in repo.submodules()? {
let mut update_opts = SubmoduleUpdateOptions::new();
let mut cb = RemoteCallbacks::new();
cb.credentials(|_url, username_from_url, _allowed| {
Cred::ssh_key(
username_from_url.unwrap_or("git"),
None,
ssh_key_path,
None,
)
});
let mut fo = FetchOptions::new();
fo.remote_callbacks(cb);
update_opts.fetch(fo);
submodule
.update(true, Some(&mut update_opts))
.map_err(|err| color_eyre::eyre::eyre!("Failed to update submodule: {:?}", err))?;
}
- Ngôn ngữ chính
- Rust
- Star
- 2.1k
- Fork
- 470
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rust-lang/git2-rs
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messageCó thể đã có người làm @shivampwm2020 đã nhận 43 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rust-lang/git2-rs
Issue tương tự
-
bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows microphone listing treats words in a device name as DirectShow labelsCó thể đã có người làm @Sujal-chaudhary đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
clipy-recorder/clipy#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nightly-cleanup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
max-sixty/worktrunk#4939 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursĐang mởflaky
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
stacks-network/stacks-core#7918 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày