Sunday, March 14, 2021

Using multiple github accounts with different keys

Create and edit `.ssh/config` and add:

#activehacker account
Host github.com-activehacker
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_activehacker

#jexchan account
Host github.com-jexchan
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_jexchan

After which, clone repos as:

git clone git@github.com-activehacker:activehacker/gfs.git gfs_jexchan
________________________^
as oppose to:
git clone git@github.com:activehacker/gfs.git gfs_jexchan

No comments:

Post a Comment