MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / git_ssh_credentials_callback

Function git_ssh_credentials_callback

flow-quickstart/src/git.rs:149–164  ·  view source on GitHub ↗
(identity: Option<PathBuf>)

Source from the content-addressed store, hash-verified

147}
148
149fn git_ssh_credentials_callback<'a>(identity: Option<PathBuf>) -> Result<RemoteCallbacks<'a>> {
150 let private_key = get_private_key_path(identity)?;
151 info!(
152 "{} `{}` {}",
153 style("Using private key:").bold(),
154 style(pretty_path(&private_key)?).bold().yellow(),
155 style("for git-ssh checkout").bold()
156 );
157 let mut cb = RemoteCallbacks::new();
158 cb.credentials(
159 move |_url, username_from_url: Option<&str>, _allowed_types| {
160 Cred::ssh_key(username_from_url.unwrap_or("git"), None, &private_key, None)
161 },
162 );
163 Ok(cb)
164}
165
166/// home path wrapper
167fn home() -> Result<PathBuf> {

Callers 1

git_clone_allFunction · 0.85

Calls 1

get_private_key_pathFunction · 0.85

Tested by

no test coverage detected