生成ssh key时同时指定保存的文件名

ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa.coding.net -C "[email protected]"

配置ssh的config

Host tencent.net
    HostName git.dev.tencent.net
    User t3service
    IdentityFile ~/.ssh/id_rsa.coding.net
如果是为git服务网站配置ssh公钥要用用户名作为文件名。比如你在coding.net的用户名是coding888,你在生成时要如下指定:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/coding888 -C "任意邮箱@server.net"