I don't understerstand how I can use git with HTTPS without having to type in my password every time?

Issue

As far as I know, when you use git with https, you would have to type in your password every time you make a request to github unless you use SSH or you store your credentials locally on your computer with git config credential.helper store .

I’ve been using HTTPS but never have to type in my credentials. When I run git config –list it only shows my email and my name, but not my password. Can anyone explain to me why I am not required to type in my password or where it could be stored?

Solution

I’ve been using HTTPS but never have to type in my credentials.

That is probably because your credentials are already cached by a credential helper.

  1. Check what yours is: git config --global credential.helper
  2. Check what credentials are stored:

In a Git bash session:

printf "host=github.com\nprotocol=https" | git-credential-xxx get

Replace xxx by the value returned by git config --global credential.helper.

If it is empty, and if the remote URL is an HTTPS one, then, as suggested by LeGEC in the comments, Git might still be using SSH anyway with an url.<base>.pushInsteadOf directive.
Check that with:

git config --show-origin --list --show-scope | grep -i insteadOf

The OP adds in the comments:

running git config --show-origin --list gives me, among other things, file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig credential.helper=osxkeychain
So it could look like it is stored in my osxkeychain?

If that is the case:

printf "host=github.com\nprotocol=https" | git-credential-osxkeychain get

See also "Updating credentials from the macOS Keychain".

Answered By – VonC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published