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