SSH KEY BITBUCKET

otrotabi-admin May 13, 2013

Hi,

I get "Invalid ssh key" when following the instructions on the tutorial for windows when I try to enter a new ssh key. Keys are generated running ssh-keygen.

Same thing happens when generating keys in our ubuntu server again using ssh-keygen.

The only way I was able to enter a valid key was by using the intructions given on the following blog:

http://blog.muhammada.li/setting-up-ssh-access-to-bitbucket-on-windows

which uses puttygen to generate the keys. Why is that ?

Is is necessary to convert keys to a different format ? Or, is it possible to enter puttygen s generated keys instead of generating them with ssh-keygen ?

Regards

José

9 answers

1 accepted

0 votes
Answer accepted
otrotabi-admin May 13, 2013

The problem was not winvi or notepad, actually you need to copy the key only up to the "==" part at the end. Thanks for your help.

rpetes April 4, 2020

asdf

1 vote
mlee2012 October 31, 2013

I hate ssh key setup I need to keep using http although it keeps asking password.

1 vote
m
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2013

Jose,

I just ran a test in GitBash I generated a key with ssh-keygen and pasted it into BB. The key was accepted.

The only difference was I used Notepad to open the key. Selected All, copied, and pasted into BB. Would you mind trying Notepad?

Mary

1 vote
aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 13, 2013

From your description, it sounds like this could also be a copy/paste error. If you've generated a key on Ubuntu and the website is telling you 'invalid key' that probably means that there are line breaks in the copy. It can depends on what method you used to copy the key.

Are you following our entire 101 from start to finish setting up both Git and Hg? There are some steps that are present in Git related pages and not Hg and vice versa. The guide is meant to be followed completely. For example, setting up SSH for Hg includes instructions using puttygen.

Lastly, that other blog was written a very long time ago before the 101 guide was completely rewritten from the ground up. Id' advise trying it and please let us know your specific issues here, in comments on it or directly in private to support@bitbucket.org. Our goal is to get you going quickly whichever method you choose.

0 votes
Alexander Kolker December 5, 2018

Hello

I need to generate SSH KEY programmatically in order to put it each time in new repository. because each time a user is difference.

Please suggest my how I can generate a new SSH key by C#

Thanks

0 votes
don_gil October 25, 2018

copy exactly the same text, in bitbucket and in an independent project hosted in bitbucket, in one works fine and in the other not. It is the same key copied to the clipboard. this sucks. 

firts copy paste, in custom domain server hosted by bitbucket.  


image.png

Same copy/paste , in bitbucket server

image.png

0 votes
otrotabi-admin May 13, 2013

Yes, it looks like it was a broken key issue. What I did was to ftp the key to my windows PC and copied it from there. Thanks for your help.

0 votes
otrotabi-admin May 13, 2013

Hi Mary,

Thanks for your fast answer. I do not think it s our firewall blocking port 22, actually we are analyzing moving from Github to Bickbucket (Github does ork over ssh). Also it looks like the problem is with the key itself, I mean, the problem is that keys generated by ssh-keygen are not accepted by Bitbucket.

Yes, I am using GitBash in windows and openssh_5.9 in the case of our ubuntu server.

Please correct me if I am wrong:

In windows:

*I open GitBash and run ssh-keygen
*I open winvi and copy id_rsa.pub contents (GitBash does not let me select text using the mouse)
*I paste the contents of id_rsa.pub to the "Key" field on the SSH Keys entry in my account

Here s a sample key as generated with ssh-keygen

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAy8c18qkT/DVkLb3H2JZUbHXEdyTfMI/qSN6tV83upg8W7q7MmqtfMtMOjkCYJxzY8nCHlrT9CTzTebxgxRMMSvw6rXa7MAV3ZVn2DTjKPx0IkKiPJyjA7wT97JNSL1r7AxLT9TGq+WuLkB7WXWBnMnSv1OxxV0l34DSbIxDgo6CbaLrVlGR7argYw9Lcxkw7Z9bacWgSb8JYdgvZ5m66siRgBA2Q1IHT6f9cVlkgc0PONWLbtvCVCUjXZnx7RqW2F4VCcBFcoTUgh76iUdWSfojFk1Hdp8PCYbdbyoF+4T6nRCubPi85YFBi6zkSiJmdvGJrmEcUMkHmqq0luHCiKQ== José@JOSE-DV5

And here s a sample key as generated with puttygen

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEA2V0QPwQzbpz4tG5T5Qjo4GTgd/nChpq4xtu0jcI8jp0kXN2asPSDye7ceWcd6dypQIm3voyOgQ2ropaHRqVgjAKaQMvSXhMruUSHfjEEkCJz0H2Mj+P8Z/zg9/eP2YgPguW7W4m6pYivT0kZfkCiKkzc9oWyfIt7NVjgSaDrLJE= rsa-key-20130513

This last entry is accepted by Bitbucket, while the other is not. I can notice some differences, for example, ssh-keygen s generated key mentions my name and computer name at the end while puttygen s key ends with rsa-key and a number, but I do not have a clue on what these differences mean.

Please let me know if you need me to run any other command and I will copy it s output to you.

Regards

Jose

0 votes
m
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2013

Jose,

You don't say whether you are using GitBash but I'll assume you are. Without the command + the output your situation is hard to debug.

You might have a situation where your adminstrator is blocking SSH on port 22. You can try our toubleshooting guide to find out more:

https://confluence.atlassian.com/display/BITBUCKET/Troubleshooting+SSH+Issues

Mary

aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 13, 2013

I think I see your issue. Can you remove your name from the tail end when you copy it? Sometimes there are issues with non-ascii characters.

otrotabi-admin May 13, 2013

Hi Mary,

Thanks for your fast answer. I do not think it s our firewall blocking port 22, actually we are analyzing moving from Github to Bickbucket (Github does ork over ssh). Also it looks like the problem is with the key itself, I mean, the problem is that keys generated by ssh-keygen are not accepted by Bitbucket.

Yes, I am using GitBash in windows and openssh_5.9 in the case of our ubuntu server.

Please correct me if I am wrong:

In windows:

*I open GitBash and run ssh-keygen
*I open winvi and copy id_rsa.pub contents (GitBash does not let me select text using the mouse)
*I paste the contents of id_rsa.pub to the "Key" field on the SSH Keys entry in my account

Here s a sample key as generated with ssh-keygen

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAy8c18qkT/DVkLb3H2JZUbHXEdyTfMI/qSN6tV83upg8W7q7MmqtfMtMOjkCYJxzY8nCHlrT9CTzTebxgxRMMSvw6rXa7MAV3ZVn2DTjKPx0IkKiPJyjA7wT97JNSL1r7AxLT9TGq+WuLkB7WXWBnMnSv1OxxV0l34DSbIxDgo6CbaLrVlGR7argYw9Lcxkw7Z9bacWgSb8JYdgvZ5m66siRgBA2Q1IHT6f9cVlkgc0PONWLbtvCVCUjXZnx7RqW2F4VCcBFcoTUgh76iUdWSfojFk1Hdp8PCYbdbyoF+4T6nRCubPi85YFBi6zkSiJmdvGJrmEcUMkHmqq0luHCiKQ== José@JOSE-DV5

And here s a sample key as generated with puttygen

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEA2V0QPwQzbpz4tG5T5Qjo4GTgd/nChpq4xtu0jcI8jp0kXN2asPSDye7ceWcd6dypQIm3voyOgQ2ropaHRqVgjAKaQMvSXhMruUSHfjEEkCJz0H2Mj+P8Z/zg9/eP2YgPguW7W4m6pYivT0kZfkCiKkzc9oWyfIt7NVjgSaDrLJE= rsa-key-20130513

This last entry is accepted by Bitbucket, while the other is not. I can notice some differences, for example, ssh-keygen s generated key mentions my name and computer name at the end while puttygen s key ends with rsa-key and a number, but I do not have a clue on what these differences mean.

Please let me know if you need me to run any other command and I will copy it s output to you.

Regards

Jose

mukkaram January 4, 2021

thanks, it's working. I copied the id_rsa got error invalid key then copy the id_rsa.pub

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events