我使用 KeePassXC 作为密码管理器已经有一段时间了,我对它非常满意。今天我决定尝试将其设置为ssh agent
. 我感兴趣的平台是 Windows 和 Linux。我按照超级用户的这篇文章,将我的 ssh 密钥添加到 KeePassXC。正如所宣传的,如果数据库解锁并且我运行,ssh-add -l
我会看到来自 KeePassXC 的密钥,而当数据库锁定时,我看不到密钥。
现在的问题是正确设置值~/.ssh/config
。我想避免代理只尝试所有可用的 ssh 密钥。所以我将以下两行添加到我的顶部~/.ssh/config
IdentitiesOnly yes
PasswordAuthentication no
正如另一篇超级用户帖子中所述,我将公钥添加到~/.ssh/config
Host bitbucket
HostName bitbucket.mycompany.com
User Sito
IdentityFile C:\Users\Sito\.ssh\bitbucket.pub
另一篇文章则声称
ssh
如果将 KeePassXC 添加到代理,将使用正确的密钥。
所以我跑了
> ssh -vvv -T [email protected]
...
debug1: Offering public key: C:\\Users\\Sito\\.ssh\\bitbucket.pub RSA HASH explicit agent
...
debug1: Server accepts key: C:\\Users\\Sito\\.ssh\\bitbucket.pub RSA HASH explicit agent
...
Authenticated to bitbucket.mycompany.com ([IP]:PORT)
...
shell request failed on channel 0
但是当我尝试从git clone
我们的服务器获取存储库时,我收到以下错误
> git clone ssh://git@link_to_repo
Load key "C:\\Users\\Sito\\.ssh\\bitbucket.pub": invalid format
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我再次尝试对此进行调试,git config --global core.sshCommand='ssh-vvv'
但消息之前的最后一部分invalid format
只是
...
debug1: Server accepts key: C:\\Users\\Sito\\.ssh\\bitbucket.pub RSA HASH explicit
debug3: sign_and_send_pubkey: using publickey with RSA HASH
debug3: sign_and_send_pubkey: signing using rsa-sha2-512 HASH
Load key "C:\\Users\\Sito\\.ssh\\bitbucket.pub": invalid format
...
与这里唯一的区别ssh -T
似乎是它不是explicit agent
在最后只是说explicit
。有想法该怎么解决这个吗?