其实很简单,在 config 里加一个 Host 指明依赖的私钥,就可以用不同身份访问 git@github.com。然后把本地 repository 的 git remote 连接更新为 <Host>:GithubName/repo.git 即可
案例
# 配置第二个 GitHub 账户
# by gpt
Host github-new
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_new
IdentitiesOnly yes
此时 ssh github-new 的身份是 new
然后把 git remote 的连接中 git@github.com 替换成 github-new 即可。
3740

被折叠的 条评论
为什么被折叠?



