在~/.ssh 添加config文件
github
Host github.com
HostName github.com
User xxx
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.github
github:
ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "xxx@xx.com"
gitlab:
ssh-keygen -t rsa -C "xxx@xxx.com"
ssh-add ~/.ssh/id_rsa.github
ssh-add ~/.ssh/id_rsa
id_rsa.github.pub里面的内容粘贴到https://github.com/settings/keys 里面
同样id_rsa.pub粘贴到gitlab的keys里面
ssh -T git@github.com
ssh -T git@git.xxx.com
在 ~/.gitconfig里面设置gitlab提交的用户名密码
[user]
name = xxxx
email = xxx@xxx.com
[core]
autocrlf = input
或者取消
git config --global --unset user.name 取消全局设置
git config --global --unset user.email 取消全局设置
网友评论