I have followed the steps to add a ssh key on my GitHub account. Now I want to do the same thing and for my BitBucket account. Do I need to ssh-keygen again for my Bitbucket or can I use the same key that I used for my GitHub?

  • Yes, you may use the same key. – grooveplex Aug 1 '16 at 17:10
  • Which is the correct way of doing it? by using the same or a new key for the bitbucket account ? – ltdev Aug 1 '16 at 17:11
  • it depends. But if you use separate keys, in the event of a breach, you can selectively replace the breached key (as opposed to generating a new one and having to change it on two services) – grooveplex Aug 1 '16 at 17:13
  • Sorry I didn't understand that, could you explain thorougly please ? – ltdev Aug 1 '16 at 18:19

Common practice is to use the same key for different servers (from one device). If the key gets compromised, you need to replace the key on all the servers.

Using multiple keys requires more complicated configuration and usually does not add much security (when something is compromised, it is usually your computer with all the keys).

It also depends on having or not having the passphrase and the key encrypted.

| improve this answer | |
  • Thank you for the reply! I wasn't sure if I should use the same ssh key for my BitBucket account or if I create a new one whether I 'd overwrite the .ssh file. However I read carefully the documentation and found out how to add the same key that I used for my github account and to my bitbucket. Works as I expected! :-) – ltdev Aug 1 '16 at 20:10
  • 1
    Overwriting the original key would not be a good idea. – Jakuje Aug 1 '16 at 20:11
  • The only time I would recommend two separate private-public key pairs is if the user has two computers, say a laptop and a desktop. In that case, each one (the laptop and the desktop) should have their own private keys and corresponding public keys in the github and bitbucket servers. – user68186 Aug 1 '16 at 20:24
  • @user68186 exactly that I wanted to write, but since it was not part of the question, I left that out. But feel free to add it. – Jakuje Aug 1 '16 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.