GitHub 上使用两个用户,两个不同的 SSH Key
编辑:
$ vi ~/.ssh/config
新增:
...
Host github.com-user1
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_user1
Host github.com-user2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_user2
后续的 remote 按需要使用 github.com-user1
或者 github.com-user2
来做为 host 名:
Clone 新项目:
git clone github.com-user2:USER/REPO
修改老项目:
git remote set-url origin github.com-user2:USER/REPO
nb