1. Bitbucket
  2. Public Issue Tracker
  3. master
  4. Issues

Issues

Issue #3052 resolved

Can't upload public key; it's rejected as "invalid" (BB-3096)

Alan Mackenzie
created an issue

I have attempted to upload my public key, id_dsa.pub (file attached). This is rejected as being an invalid key.

I have also tried copy/pasting it line by line into the little box for this purpose. This was likewise rejected.

Comments (24)

  1. Charles McLaughlin

    Hi,

    I haven't been able to replicate this bug report. I was able to upload and paste your public key into my local/development version of Bitbucket, which matches what we have on the production site. Not sure what to make of this.

    Regards,

    Charles

  2. Anonymous

    i'm having the same issue. using windows 7 and have tried with chrome and firefox. public key is of type ssh-2 rsa, made with puttyGen.

  3. Dylan Etkin

    We have just rolled out an enhancement that lets you add labels to your SSH keys.

    As part of this effort and in an attempt to simplify the workflow we have removed file upload for ssh keys. Instead we OS detect and provide a command that will help you put the key into your clipboard.

    Cheers,

    Dylan

  4. Nathan Finch

    This is still happening to me. I even tried switching from CRLF to LF line endings just to see if that mattered. It didn't. My key is also ssh-2 RSA generated from puttygen.

  5. Shaun Williams

    Nathan, make sure to paste what's in the textbox in PuTTYgen titled "Public key for pasting into OpenSSH authorized_keys file". Don't paste the contents of the private key file. They differ.

  6. Argand

    IMPORTANT: be sure to read the comment from Shaun Williams, I just ran into this problem myself because I was pasting the contents of my public key file created via the "Save public key" feature. That button/file menu item, will generate a PEM format public key, whereas the textarea at the top of PuttyGen titled "Public key for pasting into OpenSSH authorized_keys file:" is the OpenSSH formatted version of your public key file, the version that Bitbucket requires.

    It's a little bass ackwards considering by default ssh-keygen produces an OpenSSH format and requires a conversion command switch to generate the PEM format. But that's the skinny - for more info: http://help.globalscape.com/help/eft6/Server_SSH_Key_Formats.htm

    That's the limit of my knowledge regarding ssh keys, so if you try this and still can't get it to work, sorry. :(

  7. Chris Lyon

    The documentation is correct but doesn't really cover user experience very well. If you have an existing private key on your system then you can Load it into PuTTYGen and it will display the key in the correct format in the Public key for pasting into OpenSSH authorized_keys file: section.

    This can be copied and pasted into the BitBucket add key dialog text box. ( Well it works for me, after much mucking around) It seems the application is a bit fussy about the sorts of headers & tailers that get added as a matter of course to these files.

  8. Arkadiusz Krakiewicz

    It's worked for me, but ONLY when I choosed in Putty Key Generator:

    SSH-2 RSA

    1024 bits

    and copy public key from puttyGen window "OpenSSH authorized_keys", well NOT FROM SAVED FILE with public key!

  9. Alex Henderson

    This worked for me. The (SSH-2 RSA, 2048 bit) puttygen public key file looks like this...

    ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "rsa-key-20140416" AAAAB3NzaC1yc2EAAAABJQAAAQEAu+qEadidPTkxW5dydJj0466fbSCzBnN+J1Lq ...<snip>... 6HPxeGQHm3xl7hx1ADiEFAwTrPKHy3hWR4nvyl7DUZaHNwUkGQ== ---- END SSH2 PUBLIC KEY ----

    Prepend 'ssh-rsa ' (that's a space after the 'a') to the second line and copy these lines to Bitbucket

    ssh-rsa AAAB3NzaC1yc2EAAAABJQAAAQEAu+qEadidPTkxW5dydJj0466fbSCzBnN+J1Lq ...<snip>... 6HPxeGQHm3xl7hx1ADiEFAwTrPKHy3hWR4nvyl7DUZaHNwUkGQ==

    You can also move the comment to the end (after the '==')

    When saving a puttygen public file the output has Unix line endings on Windows.

    It would be helpful for Atlassian to automatically parse these keys generated by putty since they're the main source of SSH keys from Windows users.

  10. Jim Jim

    Guess I will move to another repository. Spent an hour trying to put in keys with no success. Appears there is no effort to fix this ongoing problem.

  11. Bryan Beecher

    Had this issue. Was copying the key from the generated file from clicking the "Save public key" button. Copying directly from the PuTTY Key Generator textarea labelled with the text "Public key for pasting into OpenSSH authorized_keys file:". Guess it makes sense :)

  12. James Legendre

    The issue still exists. It seems to be an unpredictable bug. What I did eventually was copy from the PuTTY Key Generator by using the mouse on Windows 10 and clicking to the left of the last character, dragging to highlight, then using mouse right click to copy and paste into BitBucket. This was after generating 3 or 4 keys and not succeeding in getting BitBucket to take the public key. It could be an interface issue in how the copy is being handled, but I just could not determine how what I did when it worked was any different.

    For what it's worth this is my second time to try BitBucket and I quit without ever using it the first time because of the exact same problem. Here's hoping the path is smoother now that it's working.

  13. Umesh

    i am in windows 10. Instead of default 1024 bit key, I generated 2048 bit key and then bitbucket accepted the public key. Workaround and also more secure.

  14. Log in to comment