gitbash (cache passphrase key): Can't get the ssh-agent to run on windows, modified the .bashrc & .profile

StackOverflow https://stackoverflow.com/questions/11970447

  •  26-06-2021
  •  | 
  •  

Pergunta

can anyone help, i am on windows and git is working with my origin set to github.

Of course everytime i wish to pull / push or anything i need to supply the passphrase of the key for github.

According to what i have read i need to edit either a ~/.profile or ~/.bashrc and enter some text

see https://help.github.com/articles/working-with-ssh-key-passphrases

I have done this many times, i actually entered it in both files but when i open up a new GitBash windows nothing seems to run (i assume something is suppose to run and ask my for my passphrase according to the link above).

So of course every Push or Pull again asks me for the passphrase every single time.

I am obviosly missing something here can anyone help?

Remembering that i am on windows :-) and using gitbash that ships with git for windows.

Thanks in advance

Foi útil?

Solução

Well after a lot of investigation, i found this Remember Password, Git bash under windows

which explains exactly what is needed, its different from linux it appears.

Outras dicas

This might happen in case You've cloned the repository through the "https" method and now trying to do push/pull the "ssh" way or other way round. See if this would work out for you :

git remote set-url origin git@github.com:your_account/your_repo.git

On Windows 10 this worked for me

  1. run git bash
  2. touch ~/.profile
  3. start ~/.profile to open .profile
  4. add the following to .profile
#! /bin/bash 
eval `ssh-agent -s` 
ssh-add ~/.ssh/*_rsa

This is based on this answer. The only difference is that .bashrc did not work, instead .profile worked.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top