git clone ssh permission denied
git clone ssh://github.com/username/repository.git
is wrong. You should be doing:
git clone ssh://[email protected]/username/repository.git
or better yet:
git clone [email protected]:username/repository.git
If it is a public repository the whole keys thing can be avoided by using the git protocol with the fetch url.
git clone git://github.com/username/repository.git
This terribly nondescript error means that the server rejected your connection. Github has a very rich documentation this -
https://help.github.com/articles/error-permission-denied-publickey
Update -
Check if the keys and token are setup properly as per the instructions provided by GitHub. If I were you, start from scratch again. May be you haven't properly initialized SSH keys with Github -
cd ~/.ssh && ssh-keygen
cat id_rsa.pub
and copy the key into the SSH settings of the Github website.
To clone a Git repository over SSH, you specify ssh:// URL like this:
$ git clone ssh://user@server/project.git
or you can use the shorter scp-like syntax for SSH protocol:
$ git clone user@server:project.git
Just wanted to make sure you're copying a correct SSH clone URL from your Github account -
--------- SOLUTION FOR WINDOWS USERS ------------------
Was facing the same problem in windows, solved as below:
after successfully setting up private/public key for git you need to naviagte to :
C:\Program Files\Git\etc\ssh
-- open ssh-config file present under it and add below information :
Host github.com
User git
IdentityFile << absolute path to your private key for git >>
-- restart power shell and try to clone repository again
git clone <<url copied from git repo>>