以gitlab和github为例子
1. 生成rsa
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
根据要上传的仓库对rsa文件命名,如github,则rsa为id_rsa_github, gitlab,则rsa为id_rsa_gitlab
2. 编写config文件
进入C:\Users\【用户名】\.ssh 文件夹下
新建config,注意不是.txt文件,就是config文件名
# gitlab
Host 192.168.31.xxx #远程Git项目主机IP
HostName 192.168.31.xxx
Port 9998 #远程项目主机port
PreferredAuthentications publickey
IdentityFile C:\Users\hy\.ssh\id_rsa
User hu***
# github
Host github.com #远程Git项目主机IP
HostName github.com
PreferredAuthentications publickey
IdentityFile C:\Users\hy\.ssh\id_rsa_github
User hu***
评论列表
已有0条评论