使用指定秘钥推送
生成ssh秘钥到指定位置(本例中为 /home/lt/.ssh/git.lingting-gzm)
lt@lt:~/.ssh$ ssh-keygen -t rsa -C "邮箱"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lt/.ssh/id_rsa): /home/lt/.ssh/git.lingting-gzm/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/lt/.ssh/git.lingting-gzm/id_rsa.
Your public key has been saved in /home/lt/.ssh/git.lingting-gzm/id_rsa.pub.
The key fingerprint is:
修改 ssh配置文件
lt@lt:vim ~/.ssh/config
添加如下内容:
# 自定义的host
Host git.lingting.gzm
# 指向 github
HostName github.com
User git
# 指向前面生成的ssh秘钥
IdentityFile /home/lt/.ssh/git.lingting-gzm/id_rsa
# 指定唯一
IdentitiesOnly true
修改 remote 路径
项目仓库的ssh路径: git@github.com:lingting-gzm/spring-dependency.git
项目修改后的路径: git@git.lingting.gzm:lingting-gzm/spring-dependency.git
将 github.com 修改为 配置文件中的自定义host

1324

被折叠的 条评论
为什么被折叠?



