Adding a ssh public to Gitlab

I needed to add my ssh public key to Gitlab. Pretty straight forward generating it using PuttyGen and saving the public and private keys. When I pasted they public key into the dialog in Gitlab and hit “Add key” I got the following error.

The form contains the following errors:

  • Key is invalid
  • Key should be a single line
  • Fingerprint has already been taken
  • Fingerprint cannot be generated

I checked the public key and saw that it was not a single line. To correct this I did the following.

  • Deleted the “—- BEGIN SSH2 PUBLIC KEY —-” line
  • Deleted the “—- END SSH2 PUBLIC KEY —-” line
  • Deleted the “Comment: …” line
  • Removed all line ends from the generated key
  • Added “ssh-rsa ” before the key
  • Make sure there is an empty line after the key

That’s it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s