AddKeysToAgent是ssh配置在Mac上不起作用 [英] AddKeysToAgent yes ssh config not working on Mac

查看:516
本文介绍了AddKeysToAgent是ssh配置在Mac上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将ssh配置文件设置为自动将ssh密钥添加到ssh代理.但是,当前它不起作用.它以前在工作.我更新了bitbucket的ssh密钥,它不再起作用.重新启动后,必须使用ssh-add -K选项手动添加ssh密钥.

Hi I have my ssh config file setup to auto add ssh keys to ssh agent. However, currently it is not working. It was working previously. I updated the ssh key for bitbucket and it no longer works. When I reboot, I have to add the ssh key manually using ssh-add -K option.

有人可以帮我弄清楚为什么ssh config无法正常工作吗?假设使用AddKeysToAgent yes选项可以启用ssh密钥的自动添加.

Can someone help me figure out why ssh config isn't working? AddKeysToAgent yes option is suppose to enable the auto adding of ssh keys.

我正在运行macOS Sierra 10.12.4

I am running macOS Sierra 10.12.4

这是配置(出于敏感目的,我更改了服务器名称)

Here is config (I changed server names for sensitivity purposes)

GSSAPIAuthentication no

# --- SourceTree Generated ---
Host cik-bitbucket__com
    HostName bitbucket.com
    User cik
    PreferredAuthentications publickey
    IdentityFile /Users/cik/.ssh/cik-bitbucket__com
    UseKeychain yes
    AddKeysToAgent yes
# ----------------------------

Host *
    UseKeychain yes
    AddKeysToAgent yes
    ServerAliveInterval 15
    IdentityFile /Users/cik/.ssh/id_rsa

Host jenkins
    HostName pasjenkins1.mycompany.com
    UseKeychain yes
    AddKeysToAgent yes

Host jenkinsqa
    HostName pasjenkinsqa.mycompany.com
    UseKeychain yes
    AddKeysToAgent yes

Host artifactory
    HostName prp01
    UseKeychain yes
    AddKeysToAgent yes

Host bitbucket
    HostName bitbucket
    UseKeychain yes
    AddKeysToAgent yes

Host confluence
    HostName confluence01
    UseKeychain yes
    AddKeysToAgent yes

Host jira
    HostName jira01
    UseKeychain yes
    AddKeysToAgent yes

Host vagrant
    HostName 127.0.0.1
    Port 2222
    User vagrant
    IdentityFile /Users/cik/.vagrant.d/insecure_private_key

Host localhost
    HostName 127.0.0.1
    Port 2222
    User vagrant
    IdentityFile /Users/cik/.vagrant.d/insecure_private_key

更新:

订单很重要.

这有效

ssh-add -D
ssh-add -K /Users/cik/.ssh/cik-bitbucket__com
ssh-add
git push (Works)

不起作用

ssh-add -D
ssh-add
ssh-add -K /Users/cik/.ssh/cik-bitbucket__com
git push (Works)

推荐答案

您的代理中密钥太多,在服务器拒绝之前只能尝试有限数量的密钥.幸运的是,您具有很好的配置,可以区分每个主机的密钥,因此您应该可以通过设置来解决此问题

You have got too many keys in your agent and only limited amount can be tried before rejecting by server. Fortunately, you have quite nice configuration distinguishing the keys per hosts, so you should be able to fix that by setting

IdentitiesOnly yes

中的

配置选项.

configuration option in your ssh_config.

这篇关于AddKeysToAgent是ssh配置在Mac上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆