1

I have done serval times How to solve Permission denied (publickey) error when using Git?

But, every time I close git bash and reopen it. It prompts enter image description here Then I input

eval $(ssh-agent -s)
ssh-add ssh.txt
input my password

can resolve this problem. But when I reopen the git bash, I have to do everything again. How can I avoid this boring operation?

Administrator
  • 254
  • 1
  • 8

1 Answers1

1

Modify your %USERPROFILE%\.bashrc in order to run your ssh-agent for you: see here for an example.

That way, you won't have to repeat those commands every time you open a new bash.

See also "Auto-launching ssh-agent on Git for Windows", from GitHub.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • There is no .bashrc in there. There is .bash_history and .gitconfig. – Administrator Dec 04 '18 at 01:55
  • @zhang Then you can *create* a file called `.bashrc` in your `%USERPROFILE%` folder, where you put what is described in https://help.github.com/articles/working-with-ssh-key-passphrases/#auto-launching-ssh-agent-on-git-for-windows. – VonC Dec 04 '18 at 07:10