Issue fetching submodules with credentials callback
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Comienza con el flujo reproducido utilizando RepoBuilder::clone, RemoteCallbacks::credentials, SubmoduleUpdateOptions::new, update_opts.fetch y submodule.update. Compara cómo se pasa el callback durante la clonación con la forma en que las actualizaciones de submódulos realizan su fetch y, después, confirma que se respeta el callback de la clave SSH y que la actualización del submódulo se completa sin el error “no callback set”.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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))?;
}
- Lenguaje dominante
- Rust
- Estrellas
- 2.1k
- Forks
- 470
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rust-lang/git2-rs
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messagePosiblemente ocupada @shivampwm2020 la tomó hace 43 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
Todos los issues de rust-lang/git2-rs
Issues similares
-
bug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Windows microphone listing treats words in a device name as DirectShow labelsPosiblemente ocupada @Sujal-chaudhary la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
clipy-recorder/clipy#447 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
nightly-cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
max-sixty/worktrunk#4939 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursAbiertoflaky
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
stacks-network/stacks-core#7918 · 1 comentario ·
Los mantenedores suelen responder en 2 días