在~/.ssh文件夹下新建文件config,格式例如以下
Host "authmanage"
HostName "code.csdn.net"
User "git"
IdentityFile "C:/Users/WangJun/.ssh/id_rsaAuthManage"
Host "demo"
HostName "code.csdn.net"
User "git"
IdentityFile "C:/Users/WangJun/.ssh/id_rsaDemo"
參数解说:
比方你的git地址是:[email protected]:wangjuntytl/authmanage.git
所以你配置了config文件后。就不要在直接使用命令:git clone [email protected]:wangjuntytl/authmanage.git
而是使用git clone [email protected]:wangjuntytl/authmanage.git 命令,ssh会依据你设置host找到相应的hostname
附:生成ssh私钥公钥的命令:
ssh-keygen -t rsa -C “your email” -f filename
时间: 2024-10-25 16:24:33