Issue fetching submodules with credentials callback
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
RepoBuilder::clone、RemoteCallbacks::credentials、SubmoduleUpdateOptions::new、update_opts.fetch、submodule.update を使用した再現フローから始めます。クローン時に callback が渡される方法と、submodule の更新で fetch が実行される方法を比較し、そのうえで SSH キーの callback が適用され、「no callback set」エラーなしに submodule の更新が完了することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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))?;
}
- 主要言語
- Rust
- スター
- 2.1k
- フォーク
- 470
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-lang/git2-rs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 message対応中かも @shivampwm2020 が 43 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
rust-lang/git2-rs の issue をすべて見る
似ている issue
-
bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
Windows microphone listing treats words in a device name as DirectShow labels対応中かも @Sujal-chaudhary が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
clipy-recorder/clipy#447 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
nightly-cleanup
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
max-sixty/worktrunk#4939 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursオープンflaky
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
stacks-network/stacks-core#7918 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信