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

Function get_private_key_path

flow-quickstart/src/git.rs:143–147  ·  view source on GitHub ↗

takes care of `~/` paths, defaults to `$HOME/.ssh/id_rsa` and resolves symlinks.

(identity: Option<PathBuf>)

Source from the content-addressed store, hash-verified

141
142/// takes care of `~/` paths, defaults to `$HOME/.ssh/id_rsa` and resolves symlinks.
143fn get_private_key_path(identity: Option<PathBuf>) -> Result<PathBuf> {
144 let private_key = identity.unwrap_or(home()?.join(".ssh/id_rsa"));
145
146 canonicalize_path(&private_key).context("private key path was incorrect")
147}
148
149fn git_ssh_credentials_callback<'a>(identity: Option<PathBuf>) -> Result<RemoteCallbacks<'a>> {
150 let private_key = get_private_key_path(identity)?;

Callers 1

Calls 2

homeFunction · 0.85
canonicalize_pathFunction · 0.85

Tested by

no test coverage detected