Skip to content

fix credential.helper usage #1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- support adding annotations to tags ([#747](https://github.com/extrawurst/gitui/issues/747))
- support inspecting annotation of tag ([#1076](https://github.com/extrawurst/gitui/issues/1076))
- support deleting tag on remote ([#1074](https://github.com/extrawurst/gitui/issues/1074))
- support git credentials helper (https) ([#800](https://github.com/extrawurst/gitui/issues/800))

### Fixed
- Keep commit message when pre-commit hook fails ([#1035](https://github.com/extrawurst/gitui/issues/1035))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ These are the high level goals before calling out `1.0`:

- no support for GPG signing (see [#97](https://github.com/extrawurst/gitui/issues/97))
- no git-lfs support (see [#1089](https://github.com/extrawurst/gitui/discussions/1089))
- *credential.helper* for https needs to be **explicitly** configured (see [#800](https://github.com/extrawurst/gitui/issues/800)

Currently, this tool does not fully substitute the _git shell_, however both tools work well in tandem.

Expand Down
5 changes: 3 additions & 2 deletions asyncgit/src/sync/cred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{
remotes::get_default_remote_in_repo, repository::repo, RepoPath,
};
use crate::error::{Error, Result};
use git2::{Config, CredentialHelper};
use git2::CredentialHelper;

/// basic Authentication Credentials
#[derive(Debug, Clone, Default, PartialEq)]
Expand Down Expand Up @@ -59,9 +59,10 @@ pub fn extract_username_password(
//if the username is in the url we need to set it here,
//I dont think `config` will pick it up

if let Ok(config) = Config::open_default() {
if let Ok(config) = repo.config() {
helper.config(&config);
}

Ok(match helper.execute() {
Some((username, password)) => {
BasicAuthCredential::new(Some(username), Some(password))
Expand Down