Apparently valid SSH key is rejected by Bitbucket's SSH key page (BB-9079)
I recently ran into difficulty adapting my Git workflow to Bitbucket. I've been using a particular SSH key for my work, but when I tried to import it into Bitbucket, I got an "Invalid SSH key" message.
#4929 approaches this by asking for a better error description. However, I'm almost positive this one was a mistake on Bitbucket's part, not a problem with my SSH key, and should be addressed at the source. I say this because I was able to use this key in GitHub, and import it from GitHub to Bitbucket, without problems!
Steps to reproduce: Log into Bitbucket. Up in the top right, click on the popdown menu with my avatar icon, and select "Manage account". In the right-hand nav, select "SSH keys". Click on the button "Add key". In the "Add SSH key" dialog: under Label, enter: osmith@home. Under Key, copy the key from my id_dsa.pub and paste. Then click on the button "Add key".
Expected behavior: Bitbucket accepts the key, dismisses the dialog, and shows the newly entered key in the SSH keys list. Git clones on my account work with this new key.
Actual behavior: Bitbucket takes a few seconds, and then displays an error message below the Key field: "Invalid SSH key." No Git work can be done with the key.
Workaround: Import the key into GitHub (which succeeds), then return to Bitbucket, come back to the "SSH keys" page, and click on the button "Import keys from GitHub." A message is displayed, "1 key imported," and the new key is listed in my SSH keys. Git clones now work.
Data: See user account ods94065 for the specific key that Bitbucket didn't like. It is a DSA key, which I believe I created via openssh on a Mac by running 'ssh-keygen -t dsa'. The key name is "email@example.com".