feat: update with ssh agent support
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -121,12 +121,16 @@ fn pull_parent_cuddle_into_local(
|
||||
) -> anyhow::Result<()> {
|
||||
let mut rc = RemoteCallbacks::new();
|
||||
rc.credentials(|_url, username_from_url, _allowed_types| {
|
||||
git2::Cred::ssh_key(
|
||||
username_from_url.unwrap(),
|
||||
None,
|
||||
Path::new(&format!("{}/.ssh/id_ed25519", env::var("HOME").unwrap())),
|
||||
None,
|
||||
)
|
||||
if "true".to_string() == std::env::var("CUDDLE_SSH_AGENT").ok().unwrap_or("".into()) {
|
||||
git2::Cred::ssh_key_from_agent(username_from_url.unwrap())
|
||||
} else {
|
||||
git2::Cred::ssh_key(
|
||||
username_from_url.unwrap(),
|
||||
None,
|
||||
Path::new(&format!("{}/.ssh/id_ed25519", env::var("HOME").unwrap())),
|
||||
None,
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
let mut fo = FetchOptions::new();
|
||||
|
Reference in New Issue
Block a user