>> ssh-keygen -t rsa -C "your_email@youremail.com"
print Generating public/private rsa key pair.
>> Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa_new
然后一路回车到底
>> cat>~/.ssh/config
# 映射一个别名
host github
hostname
# 有端口需求可以加上端口映射
# port 22022
>> ctrl+D
#完整的一个config 配置文件内容host github hostname github.com IdentityFile ~/.ssh/id_rsa # 端口 #port 22022Host config HostName github.com IdentityFile ~/.ssh/id_rsa_config
>> ssh-agent bash
>> ssh-add ~/.ssh/id_rsa_new
这样就完成了整体的配置
克隆仓库的时候这样使用
>> git clone git@config:xxx/xxx.git