配置git相关信息
- 配置用户名
git config --global user.name "d4peng" - 配置邮箱
git config --global user.email "d4peng@outlook.com" - 生成公钥和私钥
ssh-keygen -t rsa -C "d4peng@outlook.com"
上传公钥到目标服务器上并登陆
- 上传
ssh-copy-id -i /home/d4peng/.ssh/id_rsa.pub root@xx.xx.xx.xx -p 22 - 登陆
ssh root@xx.xx.xx.xx -i /home/d4peng/.ssh/id_rsa
配置永久生效方式
配置alias永久生效 echo 'alias svr="ssh root@xx.xx.xx.xx -i /home/d4peng/.ssh/id_rsa"' >> .zshrc
这里我用的环境是Linux环境