一个客户端配置多个Git账户

1、生成密钥对

ssh-keygen -t rsa -C "[email protected]"


2、配置~/.ssh/config文件

#Default Git
Host defaultgit
HostName git.oschina.net
User "[email protected]"
IdentityFile ~/.ssh/id_rsa
 
#Second Git
Host secondgit
HostName 192.168.3.177
User "[email protected]"
IdentityFile ~/.ssh/id_rsa_company

3、执行 ssh-agent 命令

ssh-agent 

4、克隆项目

git clone git@secondgit:xxx.git 



你可能感兴趣的:(git,版本管理)