GIT SSH多账户配置
1、生成多对公私钥对应多个git服务器并将公钥copy到服务器上 ssh-keygen -t rsa -C "chenyh@yunhetong.net" -f id_rsa_work ssh-keygen -t rsa -C "hzchenyh@163.com" -f id_rsa_osc 2、配置全局config 全局配置文件在~/.ssh/下的config文件中: # oschina(hzcheyh@163.com) ======================================== Host osc HostName git.oschina.net User hzchenyh@163.com IdentityFile ~/.ssh/id_rsa_osc # yunhetong(chenyh@yunhetong.net) ======================================== Host yunhetong HostName 120.20.72.179 Port 7999 User git IdentityFile ~/.ssh/id_rsa_work 3、ssh测试连通性 #测试ssh到osc的连通性(osc即为上面配置的host别名) ssh -T git@osc 4、取消git全局name和email配置