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 <bitbucket.org> IdentityFile ~/.ssh/<identity> ' Host workid HostName bitbucket.org IdentityFile ~/.ssh/workid Host personalid HostName bitbucket.org IdentityFile ~/.ssh/personalid : ' Alternate config ' # Default GitHub user Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/personalid # Work user account Host bitbucket.org HostName bitbucket.org 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/personalid.pub # MacOSX can use pbcopy to copy the contents to your clipboard pbcopy < ~/.ssh/personalid.pub : ' Go to the BitBucket SSH settings, add a new key, and past the contents of the public key in there. URL: https://bitbucket.org/account/user/<username>/ssh-keys/ `<username>` is your username ' open https://bitbucket.org/account/user/<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.