配置git多环境
用户xxx: github上项目A
用户yyy: gitlab上项目B
//~/.ssh/config
host xxx.github.com
hostname github.com
user git
IdentityFile ~/.ssh/id_rsa_github
host yyy.gitlab.com
hostname gitlab.com
user git
IdentityFile ~/.ssh/id_rsa_gitlab
项目A地址 git@github.com:xxx/A.git
git clone git@github.com:xxx/A.git
git remote remove origin
git remote add origin git@xxx.github.com:xxx/A.git
git pull
项目B地址 git@gitlab.com:xxx/B.git
git clone git@gitlab.com:yyy/B.git
git remote remove origin
git remote add origin git@yyy.gitlab.com:yyy/B.git
git pull
网友评论