diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-26 13:38:48 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-26 13:38:48 +0100 |
| commit | f609ed6e45bb870c2b855ff6e0d4b4d7f36e7bd0 (patch) | |
| tree | bb81c4b0d3dcb3afaacffee543462b67df68d5ff /src | |
| parent | 0134ab8eb413b8b81ec8e179897ddb8ea63e134e (diff) | |
fix(remote): authenticate pushes
in the future we could implement our own credentials callback function
to remove the dependancy
Diffstat (limited to 'src')
| -rw-r--r-- | src/git_remote_helper.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index 6050d1a..2899fec 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -13,6 +13,7 @@ use std::{ | |||
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | use anyhow::{bail, Context, Result}; | 15 | use anyhow::{bail, Context, Result}; |
| 16 | use auth_git2::GitAuthenticator; | ||
| 16 | #[cfg(not(test))] | 17 | #[cfg(not(test))] |
| 17 | use client::Connect; | 18 | use client::Connect; |
| 18 | use client::{fetching_with_report, get_repo_ref_from_cache}; | 19 | use client::{fetching_with_report, get_repo_ref_from_cache}; |
| @@ -97,8 +98,8 @@ async fn main() -> Result<()> { | |||
| 97 | println!(); | 98 | println!(); |
| 98 | } | 99 | } |
| 99 | ["push", refspec] => { | 100 | ["push", refspec] => { |
| 100 | temp_remote.connect(git2::Direction::Push)?; | 101 | let auth = GitAuthenticator::default(); |
| 101 | temp_remote.push(&[refspec], None)?; | 102 | auth.push(&git_repo.git_repo, &mut temp_remote, &[refspec])?; |
| 102 | temp_remote.disconnect()?; | 103 | temp_remote.disconnect()?; |
| 103 | println!(); | 104 | println!(); |
| 104 | } | 105 | } |