create different ssh key, Git Bash on Windows / GNU/Linux / macOS:
$ ssh-keygen -t rsa -C "[email protected]"
copy key macOS:
$ pbcopy < ~/.ssh/<name>.pub
or GNU/Linux (requires the xclip package):
$ xclip -sel clip < ~/.ssh/<name>.pub
or Windows Command Line:
$ type %userprofile%\.ssh\<name>.pub | clip
Git Bash on Windows / Windows PowerShell:
$ cat ~/.ssh/<name>.pub | clip
for example, 2 keys created at:
~/.ssh/id_rsa_activehacker
~/.ssh/id_rsa_jexchan
then, add these two keys as following
$ ssh-add ~/.ssh/id_rsa_activehacker
$ ssh-add ~/.ssh/id_rsa_jexchan
you can delete all cached keys before
$ ssh-add -D
finally, you can check your saved keys
$ ssh-add -l
$ cd ~/.ssh/
$ touch config
$ subl -a config
Then added
#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
then use normal flow to push your code
$ git config user.name "activehacker"
$ git config user.email "[email protected]"
$ git add .
$ git commit -m "your comments"
$ git push