l'L'l l'L'l - 1 year ago 442
Git Question

git clone --recursive fails

I've encountered a strange issue while trying to recursively clone a git repository:

# git clone --recursive git@github.com:eteran/edb-debugger.git
Initialized empty Git repository in /edb-debugger/.git/
The authenticity of host 'github.com (' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Trying on another machine returned a different result:

$ git clone --recursive git@github.com:eteran/edb-debugger.git
Cloning into 'edb-debugger'...
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

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

I'm not sure what's going on with the inconsistent errors, or why this suddenly started happening when it was working perfectly fine shortly before. There are two ( separate ) other questions ( ¹ ) which mention each error, however, this is encapsulates both errors in one unrelated issue.

Any clue what the problem might be?

Answer Source

You can resolve this in 2 ways:

Either, Create ssh-key and add the public key of both computers in the github account. After that this command will work

 git clone --recursive git@github.com:eteran/edb-debugger.git

Or, clone using https. This will prompt for credentials enter the credentials and it will be cloned

git clone --recursive https://github.com/eteran/edb-debugger.git

In case you are having problem with already created ssh keys use this command to see if your ssh key is loaded properly and your public key is added properly in your github account. To see your loaded key:

ssh-add -l

It should list your key like this:

2048 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /Users/<username>/.ssh/id_rsa (RSA)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download