At Pivotal we share Mac workstations, so we typically log in for the day.
I used to carry my SSH key on a USB stick. Now it's a backup and I load my SSH key using LastPass.
- LastPass account
- LastPass CLI:
brew install lastpass-cli
-
Create a new SSH key; GitHub has a decent guide
-
Put the private key in the notes field of a LastPass secure note, e.g. "Personal/GitHub SSH key"
-
Customise the load script, with your own variables
-
Put your custom load script in the notes field of another LastPass secure note, e.g. "Personal/Load GitHub SSH Key"
lpass login $USERNAME
# Load your SSH key until hometime!
bash <(lpass show 'Personal/Load GitHub SSH Key' --notes)
# Or, load your SSH key for 2 hours!
bash <(lpass show 'Personal/Load GitHub SSH Key' --notes) 2
For convenience we've added a function to our bash profile:
load_ssh_key() {
if lpass status; then
bash <(lpass show 'Personal/Load GitHub SSH Key' --notes) "$1"
fi
}