gitui icon indicating copy to clipboard operation
gitui copied to clipboard

investigate how to use git credential fill

Open extrawurst opened this issue 3 years ago • 6 comments

based on https://github.com/extrawurst/gitui/issues/800#issuecomment-1019589351

would be nice if we could fallback to run git credential fill cause it works (at least) on macOS by checking keychain without any explicit credential.helper being defined.

problem is: it does an interactive shell when no credentials are defined. either we figure out how to surpress this or how we can query first if there are credentials defined.

extrawurst avatar Jan 23 '22 23:01 extrawurst

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 30 '22 18:07 stale[bot]

I did a little bit of research, and as far as I can tell, there seems to be no easy way to use git credential in non-interactive mode, or to find out whether specific credentials exist.

https://git-scm.com/docs/git-credential https://stackoverflow.com/questions/51803825/how-one-may-check-whether-credential-manager-in-git-has-password-stored-for-a-gi

cruessler avatar Apr 18 '23 14:04 cruessler

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 15 '23 06:12 stale[bot]

Since I just completely borked my gitconfig, creating a SIGSEGV, I had a look into it. Looks like you can circumvent the interactive shell by piping the data into git credential fill like this:

echo 'protocol=https
host=example.com
path=test.git' | git credentials fill

This gave me the following output:

protocol=https
host=example.com
username=user
password=secret

Unfortunately I don't know, where to implement that, since I just today found out about gitui, but maybe I will look into it later.

Black616Angel avatar Jan 04 '24 14:01 Black616Angel

we are using git2-rs wich call the helper under the hood. feel free to contribute there: https://github.com/rust-lang/git2-rs/blob/master/src/cred.rs#L193

extrawurst avatar Jan 04 '24 17:01 extrawurst

https://github.com/rust-lang/git2-rs/pull/1006

Black616Angel avatar Jan 05 '24 15:01 Black616Angel