diff --git a/src/config_manager.rs b/src/config_manager.rs index 22545aa..21fdbfa 100644 --- a/src/config_manager.rs +++ b/src/config_manager.rs @@ -103,7 +103,7 @@ mod tests { use crate::config_manager::{ConfigManagement, ConfigManager, ConfigType}; use std::io::{Read, Write}; use std::path::PathBuf; - use std::{env, fs, io, panic, path}; + use std::{env, fs, io, path}; use tempfile::TempDir; type TestResult = Result<(), Box>; diff --git a/src/git.rs b/src/git.rs index bcfe10b..d0ce348 100644 --- a/src/git.rs +++ b/src/git.rs @@ -1,5 +1,6 @@ use git2::{Commit, Cred, Direction, ObjectType, Oid, PushOptions, RemoteCallbacks, Repository}; +use std::env; use std::path::Path; pub trait GitManagement { @@ -104,7 +105,12 @@ impl Git { fn get_callbacks<'a>(&self) -> RemoteCallbacks<'a> { let mut callbacks = RemoteCallbacks::new(); callbacks.credentials(|_url, username, _allowed_types| { - Cred::ssh_key_from_agent(username.unwrap()) + Cred::ssh_key( + username.unwrap(), + None, + std::path::Path::new(&format!("{}/.ssh/id_rsa", env::var("HOME").unwrap())), + None, + ) }); callbacks }