10

There are some tasks that are only possible/easier to do in git bash (or Terminal) than in SourceTree. I have most of my repositories on bitbucket and use ssh key.

enter image description here

The problem I have is that even though I load my key with SourceTree (Pageant putty client) the terminal requires me to load it again. It can be a pain with longer keyphrase as well as once the terminal is closed and opened again it is required to enter password again.

enter image description here As you can see agent is running, key is loaded, but I am still asked to enter my passphrase in git terminal/git bash.

Is there a way to load the key only once?

Thank you

rluks
  • 2,762
  • 8
  • 38
  • 56
  • 2
    Why downvoted? Please provide constructive feedback. Thanks – rluks Nov 29 '16 at 20:58
  • 1
    Any luck with this yet? I'm on the same issue, and it's annoying. – andeart Apr 06 '17 at 21:55
  • Unfortunately no, I have not used git bash for a while now, just basic git options directly in SourceTree. – rluks Apr 11 '17 at 21:34
  • 1
    You can create an ssh key without a password. If your private key is protected by other means or if the security is not an issue, this is an option. – Fabian Dec 02 '19 at 08:27

2 Answers2

2

In sourcetree settings, do you have the

Automatically start SSH agent when SourceTree opens checkbox selected?

FullStack
  • 437
  • 5
  • 15
  • Yes, I have. The agent does not seem to provide the ssh key for the terminal though. When I open the terminal and try to work with the remote I am prompted to enter password again. – rluks Nov 29 '16 at 20:57
  • its possible that your private key isn't stored in c:\Users\{username}\.ssh, when you load the terminal,sourcetree tries to find the key located here. If you type cat ~/.ssh/id_rsa.pub does it find the key? – FullStack Nov 30 '16 at 10:18
  • Yes it does. I have added a screenshot to better illustrate the issue. – rluks Dec 01 '16 at 15:02
2

I have the same issue that the SSH agent forgets the SSH key on every restart of my computer. The solution in my case as follows:

  1. Open Sourcetree.
  2. In the menu, go to "Tools", then "Options".
  3. Under "General" and then "SSH Client Configuration", enter the path to the SSH key.
  4. Enable the checkbox "Automatically start SSH agent when SourceTree opens"

If I leave the SSH Key field empty and instead add the key directly to the SSH agent, this is not permanent. It seems as if Sourcetree forwards the path to the SSH key to the SSH agent when it starts it.

Fabian
  • 4,001
  • 4
  • 28
  • 59