[ macOS Sierra ] switch 2 github account on sourceTree

This is how to use a particular IdentityFile on macOS sourcetree.

  1. add “IdentitiesOnly yes” to ~/.ssh/config, so the result will be below.
Host dsin-GitHub
HostName github.com
User dsin
PreferredAuthentications publickey
IdentitiesOnly yes
IdentityFile /Users/dsin/.ssh/dsin-GitHub

2) test it

$ ssh -T git@dsin-GitHub

or

$ ssh -vT git@dsin-GitHub

3) change your remote repo address to git@dsin-GitHub, instead of git@github.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s