配置 SSH Config 对不同 Github Repo 使用不同的 Private Key Edit SSH Config # edit config file vim ~/.ssh/config # Add Following Host repo1 HostName github.com User git IdentityFile ~/.ssh/key_for_repo1 Host repo2 HostName github.com User git IdentityFile ~/.ssh/key_for_repo2 # save :wq Update git remote url cd <path/to/repo1> # view current remote url git remote -v # update remote url git remote set-url origin repo1:<user>/<repo>.git # verify remote url git remote -v cd <path/to/repo2> # view current remote url git remote -v # update remote url git remote set-url origin repo2:<user>/<repo>.git # verify remote url git remote -v Use pull command git pull --rebase Use clone command git clone repo1:<user>/<repo>.git