diff options
author | Cyborus <cyborus@noreply.codeberg.org> | 2024-05-19 20:19:13 +0200 |
---|---|---|
committer | Cyborus <cyborus@noreply.codeberg.org> | 2024-05-19 20:19:13 +0200 |
commit | c30f7ad27f5420cd79ac6f2747ac6e803e085e6c (patch) | |
tree | c40a08c7ad5a8008e2542ec8254561d75d9c6b7b | |
parent | Merge pull request 'add `repo clone`' (#65) from repo-clone into main (diff) | |
parent | authenticate properly in `repo clone` (diff) | |
download | forgejo-cli-c30f7ad27f5420cd79ac6f2747ac6e803e085e6c.tar.xz forgejo-cli-c30f7ad27f5420cd79ac6f2747ac6e803e085e6c.zip |
Merge pull request 'authenticate properly in `repo clone`' (#66) from auth-repo-clone into main
-rw-r--r-- | src/repo.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/repo.rs b/src/repo.rs index bb19908..16bcc0b 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -482,14 +482,18 @@ impl RepoCommand { .. } = *crate::special_render(); + let auth = auth_git2::GitAuthenticator::new(); + let git_config = git2::Config::open_default()?; + let mut options = git2::FetchOptions::new(); + let mut callbacks = git2::RemoteCallbacks::new(); + callbacks.credentials(auth.credentials(&git_config)); if colors { print!("{hide_cursor}"); print!(" Preparing..."); let _ = std::io::stdout().flush(); - let mut callbacks = git2::RemoteCallbacks::new(); callbacks.transfer_progress(|progress| { print!("{clear_line}\r"); if progress.received_objects() == progress.total_objects() { |