简体   繁体   English

SourceTree 终端自动加载 ssh 密钥

[英]SourceTree terminal automatically load ssh key

There are some tasks that are only possible/easier to do in git bash (or Terminal) than in SourceTree.有些任务只有在 git bash(或终端)中才能/更容易在 SourceTree 中完成。 I have most of my repositories on bitbucket and use ssh key.我的大部分存储库都在 bitbucket 上并使用 ssh 密钥。

在此处输入图片说明

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.我遇到的问题是,即使我使用 SourceTree(Pageant putty 客户端)加载我的密钥,终端也要求我再次加载它。 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.较长的关键字可能会很痛苦,并且一旦终端关闭并再次打开,就需要再次输入密码。

在此处输入图片说明 As you can see agent is running, key is loaded, but I am still asked to enter my passphrase in git terminal/git bash.如您所见,代理正在运行,密钥已加载,但我仍被要求在 git 终端/git bash 中输入我的密码。

Is there a way to load the key only once?有没有办法只加载一次密钥?

Thank you谢谢

In sourcetree settings, do you have the在源树设置中,你有

Automatically start SSH agent when SourceTree opens checkbox selected?选中 SourceTree 打开复选框时自动启动 SSH 代理?

I have the same issue that the SSH agent forgets the SSH key on every restart of my computer.我有同样的问题,SSH 代理在每次重新启动计算机时都会忘记 SSH 密钥。 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.在“常规”和“SSH 客户端配置”下,输入 SSH 密钥的路径。
  4. Enable the checkbox "Automatically start SSH agent when SourceTree opens"启用复选框“SourceTree 打开时自动启动 SSH 代理”

If I leave the SSH Key field empty and instead add the key directly to the SSH agent, this is not permanent .如果我将 SSH Key 字段留空,而是将密钥直接添加到 SSH 代理,这不是永久的 It seems as if Sourcetree forwards the path to the SSH key to the SSH agent when it starts it.似乎 Sourcetree 在启动时将 SSH 密钥的路径转发给 SSH 代理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM