版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_43215250/article/details/90174773
-
清除git的全局设置
右键 -> Git Bash Here
git config --global user.name "charles" git config --global user.email "[email protected]"
-
生成秘钥
生成 gerrit 的 ssh key
ssh-keygen -t rsa -C '[email protected]' -f ~/.ssh/gerrit_egtest-rsa
生成 github 的 ssh key
ssh-keygen -t rsa -C '[email protected]' -f ~/.ssh/github-rsa
-
配置配置文件
在~/.ssh/目录下新建一个名为config的文件,文件内容如下
Host gerrit.xxx.xxx Port 29418 User xxx HostName gerrit.xxx.xxx PreferredAuthentications publickey IdentityFile ~/.ssh/gerrit_egtest-rsa Host github.com User charles HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/github-rsa
配置文件参数:
参数 说明 Host 表示对应的的主机名和ssh文件 HostName 要登录主机的主机名 User 登录名 IdentityFile User对应的identityFile路径