SSH
概述
系统级配置文件路径/etc/ssh/sshd_config
用户级配置文件路径~/.ssh/config
配置
常用命令:
1 | |
编辑~/.ssh/config:
1 | |
Host可用于HostName的别称,git clone git@github.com/aaa/bbb.git可替换为git clone git@GitHub/aaa/bbb.git。Port可省略设置端口号,ssh -p 36000 git@Github简写为ssh git@Github。
默认情况下只会读取 id_rsa 文件,如果想将二个公钥 github、gitlab 一起读取需要使用命令:ssh-add ~/.ssh/id_rsa_github(gitlab 同理)可以使用ssh-add -l查看秘钥,在 Windows 中需要执行ssh-add ~/.ssh/id_rsa_gitlab命令。
在 Windows 中提示“Could not open a connection to your authentication agent.”,执行ssh-agent bash即可。
参考文献
SSH
https://qpengz.github.io/tools/ssh/