feat: with auth sock
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
a210e7beff
commit
91c73c7a4e
@ -41,6 +41,9 @@ async fn main() -> eyre::Result<()> {
|
||||
|
||||
let mut cb = RemoteCallbacks::new();
|
||||
cb.credentials(|_, _, _| {
|
||||
if let Some(sock) = std::env::var("SSH_AUTH_SOCK").ok() {
|
||||
return Cred::ssh_key_from_agent("git");
|
||||
}
|
||||
let username = std::env::var("GIT_USERNAME").expect("GIT_USERNAME to be set");
|
||||
let password = std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set");
|
||||
Cred::userpass_plaintext(&username, &password)
|
||||
@ -116,6 +119,9 @@ async fn main() -> eyre::Result<()> {
|
||||
let mut remote = repo.find_remote("origin")?;
|
||||
let mut cb = RemoteCallbacks::new();
|
||||
cb.credentials(|_, _, _| {
|
||||
if let Some(sock) = std::env::var("SSH_AUTH_SOCK").ok() {
|
||||
return Cred::ssh_key_from_agent("git");
|
||||
}
|
||||
let username = std::env::var("GIT_USERNAME").expect("GIT_USERNAME to be set");
|
||||
let password = std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set");
|
||||
Cred::userpass_plaintext(&username, &password)
|
||||
|
Loading…
Reference in New Issue
Block a user