Skip to content

Instantly share code, notes, and snippets.

@allthingsclowd
Created June 4, 2019 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allthingsclowd/05a1816224a36a97bff615f2baac4373 to your computer and use it in GitHub Desktop.
Save allthingsclowd/05a1816224a36a97bff615f2baac4373 to your computer and use it in GitHub Desktop.
Typical Github download error when using freshly built server - How to fix!

Github access via SSH keys

I quite often hit the following issue when building new servers and then trying to download repositiories from github.com

graham@leader01:~ $ git clone git@github.com:allthingsclowd/web_page_counter.git
Cloning into 'web_page_counter'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
graham@leader01:~ $

This is usually because the public key github tries to use ~/.ssh/id_rsa.pub is not yet registered on github.com as an authorised ssh key.

Solution 1:

Copy you're existing github public/private keys to ~/.ssh/id_rsa.pub & ~/.ssh/id_rsa. (Note: Private key should not traverse the internet)

Solution 2:

Register the new public key located at ~/.ssh/id_rsa.pub to you github account (https://github.com/settings/ssh).

Solution 3:

Create a new key if this is your first time and you don't have an SSH key pair already and then jump back to sloution 2 above. ssh-keygen -t rsa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment