(identity: Option<PathBuf>)
| 147 | } |
| 148 | |
| 149 | fn 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 |
| 167 | fn home() -> Result<PathBuf> { |
no test coverage detected