I just wanted to create ssh key to connect to Github.

I tried to do it as described in the Github help. See link here. But this did not worked for me. I had to add some more steps. I will copy paste it a little from the github help and modify the stuff that worked for me.

Step 1: Check for SSH keys

Have an existing keypair you’d like to use? You can skip to Step 4.

First, we need to check for existing ssh keys on your computer. Open up Terminal and run:

If it says “No such file or directory” skip to step 3. Otherwise continue to step 2.


Step 2: Backup and remove existing SSH keys

Since there is already an SSH directory you’ll want to back the old one up and remove it:

Step 3: Generate a new SSH key

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

Now you need to enter a passphrase.

Which should give you something like this:


Step 4: Add your SSH key to GitHub

Run the following code to copy the key to your clipboard.

Be warned: it is important to copy the key exactly without adding newlines or whitespace. Thankfully the xclip command makes it easy to perform this setup perfectly.

xclip did not work for me. i got always an error, so i did it this way:

now you get the key on the screen, just copy it from there.

  • Click “Add SSH key”
  • Paste your key into the “Key” field

  • Click “Add key”


  • Confirm the action by entering your GitHub password

Step 5: Set owner of the file

set the ubuntu as owner for the files


Step 6: Test everything out

To make sure everything is working you’ll now SSH to GitHub. When you do this, you will be asked to authenticate this action using your password, which for this purpose is the passphrase you created earlier. Don’t change the git@github.com part. That’s supposed to be there.

You may see this warning:

Don’t worry, this is supposed to happen. Verify that the fingerprint matches the one here and type “yes”.

If that username is correct, you’ve successfully set up your SSH key. Don’t worry about the shell access thing, you don’t want that anyway.

If you see “access denied” please consider using HTTPS instead of SSH. If you need SSH start atthese instructions for diagnosing the issue.


Step 7: Remove Passphrase from key if using jenkins (optional step)

Because jenkins has problems with the passphrase for using github private repos, we will remove the passphrase for our created key

you are now asked for your old passphrase. Enter it. Leave the new blank.

test it again:

thats it.

Generating SSH Keys on Ubuntu (AWS EC2) for Github
Tagged on:                 

Leave a Reply


Get every new post on this blog delivered to your Inbox.

Join other followers:

Welcome Damir Kusar

Log in

Lost your password?
%d bloggers like this: