8

I'm trying to save my git password to avoid typing every time.

I am using git bash on windows 10.

git continues to demand a password everytime I hit remote.

(Is git bash why its not working?)

I have tried:

git config --global credential.helper 'cache --timeout 28800'

And:

git config --global credential.helper store

and:

git config --global credential.helper wincred

I've tried it in both git bash and cmd, so I guess it's not git bash causing the problem.

mtyson
  • 8,196
  • 16
  • 66
  • 106
  • 1
    What version of git? Do you use ssh URLs or http URLs for remotes? – phd May 10 '18 at 22:14
  • @phd `git version 2.16.2.windows.1` and this repo was cloned with a .git extension... so that is ssh? – mtyson May 10 '18 at 22:23
  • Well, if you don't know your remotes URLs let's see: `git remote -v`. – phd May 10 '18 at 22:47
  • @phd It looks like this: `origin matt@foo.bar:/home/matt/baz.git (fetch)` – mtyson May 10 '18 at 22:52
  • `user@host` are ssh (scp-like, to be precise) URLs, their credentials are not managed by `credential.helper`. – phd May 10 '18 at 23:08
  • @phd Is there any way to save the cred with ssh style? Or should I try using http? – mtyson May 10 '18 at 23:11
  • Possible duplicate of [SSH Key - Still asking for password and passphrase](https://stackoverflow.com/questions/21095054/ssh-key-still-asking-for-password-and-passphrase) – phd May 10 '18 at 23:13
  • @phd OK, I added an ssh key... can I force that to take without recloning repo? – mtyson May 10 '18 at 23:39
  • You don't need to reclone, you need to add the public key to your account at the server and verify with `ssh matt@foo.bar` — should login without asking for password. – phd May 11 '18 at 00:02
  • @phd Just want to say thanks for taking the time to help me understand. – mtyson May 11 '18 at 15:13

1 Answers1

11

First, for Windows, the credential helper to use is manager:

git config --global credential.helper manager

Second, this only works for HTTPS URLs, not SSH ones (user@server.com)

For SSHs, it is either:

  • asking for a passphrase because your private SSH key is passphrase-protected.
    If that is the case, check ssh-agent: see "Adding your SSH key to the ssh-agent"
  • asking for matt's password because it does not find your public key on the remote server art ~matt/.ssh/authorized_keys.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250