GIT/GITHUB

Using multiple SSH keys

This assumes, you’ve created multiple keys in your ~/.ssh directory. For example:

$ ~/.ssh/id_rsa_ACCOUNT1
$ ~/.ssh/id_rsa_ACCOUNT2

delete all cached keys

ssh-add -D

modify ssh config

Assumes sublime text (i.e. subl) is installed

$ cd ~/.ssh/
$ touch config
$ subl -a config #

Edit the file per the following:

Host github.com-ACCOUNT1
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_ACCOUNT1

Host github.com-ACCOUNT2
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_ACCOUNT2

clone repo with proper key

git clone git@github.com-ACCOUNT1:ACCOUNT1/plato_the-republic.git

Git stash

To get your most recent stash after running git stash, use

git stash apply

To see a list of your stashes, use

git stash list

You will get a list that looks something like this

stash@{0}: WIP on master: 67a4e01 Merge tests into develop
stash@{1}: WIP on master: 70f0d95 Add user role to localStorage on user login

Choose a different git stash to restore with the number that shows up for the stash you want

git stash apply stash@{2}

References