Report this

What is the reason for this report?

Unable to clone Github repo via SSH protocol. HTTPS works.

Posted on March 18, 2014

Hi, I have a very basic droplet setup. No firewalls or any sort of security measures are set up. It’s virtually open.

I wanted to clone a git repo but had some issues. Let me illustrate with an example:

$ cd /var/www $ mkdir test $ cd test $ git clone git@github.com:housni/li3_uploadable.git

The above gives me:

Cloning into ‘li3_uploadable’… Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

‘li3_uploadable’ is a public repo. I know this because I own it. Besides, I have this issue with all the other Github repos.

However, I noticed that cloning via HTTPS works:

git clone https://github.com/housni/li3_uploadable.git

I asked Digitalocean support but they were unable to help me. Any ideas on what’s going on?

Thanks.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I observed the same issue : Below steps worked for me From Terminal - > Type ssh-add -l If the output is :The agent has no identities.

Enter: ssh-add ~/.ssh/id_rsa

This command should add your keys to the local ssh-agent. Once it is been added , Try git clone <git@github.com__repo_path__>

I had SSH setup correctly and still got this error. The problem was not SSH, but simply folder permissions. The folder I was trying to clone into was owned by the root user (check this using ls -l), and using sudo is not valid when cloning a git repo. I had to change the folder to be owned by my user, like this: sudo chown -R $USER:$USER <path_to_folder>

I am experiencing this same issue and I have added my public key on Github.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.