Bash - Create Multiple SSH key Aliases for BitBucket

: ' Check if you have ssh ' ssh -v : ' Show your current keys ' ls -a ~/.ssh : ' Create new SSH key (identity) - enter password when prompted ' ssh-keygen -f ~/.ssh/personalid -C "personalid" : ' Create an SSH Config file to alias accounts ' sudo vim ~/.ssh/config : ' Type in your aliases Host <alias> HostName <> IdentityFile ~/.ssh/<identity> ' Host workid HostName IdentityFile ~/.ssh/workid Host personalid HostName IdentityFile ~/.ssh/personalid : ' Alternate config ' # Default GitHub user Host HostName PreferredAuthentications publickey IdentityFile ~/.ssh/personalid # Work user account Host HostName PreferredAuthentications publickey IdentityFile ~/.ssh/workid : ' Load Key into BitBucket `personalid` is what you named your ssh file in `~/.ssh`. `.pub` is the public key version you will paste the contents of, into bitbucket settings. ' # Show the contents that you can copy/paste cat ~/.ssh/ # MacOSX can use pbcopy to copy the contents to your clipboard pbcopy < ~/.ssh/ : ' Go to the BitBucket SSH settings, add a new key, and past the contents of the public key in there. URL:<username>/ssh-keys/ `<username>` is your username ' open<username>/ssh-keys/

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.