# generate ssh key and save to `id_rsa_another`
$ ssh-keygen -t rsa -C "[email protected]"
# save your key
$ ssh-add ~/.ssh/id_rsa
$ ssh-add ~/.ssh/id_rsa_another
# delete all your cached keys
$ ssh-add -D
# list all your saved keys
$ ssh-add -l#origin account
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
#new account
Host github.com-newusername
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_another$ git config user.name "username"
$ git config user.email "[email protected]" e.g. you have to change [email protected]:githubutilities/homebrew-cask.git to [email protected]:newusername/homebrew-cask.git for this to works
your can run
git remote -vto get the push url.