| 一、常规公钥生成1、修改信息配置  
 git config --global user.name “xxxx”git config --global user.email “xxxx@qq.com”
 查看配置  
 git config --list 2、生成密钥命令  
 ssh-keygen -t rsa 然后一直按回车键,就ok了。 3、将生成的公钥文件id_rsa.pub打开,复制其中内容,到Gitee中 如果各个平台的邮箱一致,可以使用用同一个公钥 二、多平台使用1、常规命令  
 ssh-keygen -t rsa -C ‘2219563475@qq.com’ -f ~/.ssh/github-rsa 执行以下命令: ssh-add ~/.ssh/github-rsa 如果执行ssh-add时提示"Could not open a connection to your authentication agent",则需先执行以下命令: ssh-agent bash 添加成功会出现提示:Identity added 等字样。执行以下命令: ssh-add -l 如果有列表展示出来则证明添加成功了。 2、添加或修改配置文件config 在.ssh目录下创建config文件,并在该文件中添加或修改以下内容  
 Host : Host可以看作是一个你要识别的模式,对识别的模式,进行配置对应的的主机名和ssh文件(可以直接填写ip地址)HostName : 要登录主机的主机名(建议与Host一致)
 User : 登录名(如gitlab的username)
 IdentityFile : 指明上面User对应的identityFile路径
 Port: 端口号(如果不是默认22号端口则需要指定)
 样例:  
 Host http://172.16.32.139/HostName http://172.16.32.139/
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/id_rsa
 Host github.comHostName github.com
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/github/id_rsa
 3、同上 |