Reputation: 3439
I am trying to clone a github repository but it gives me this error. (I'm using cmder bash on Windows)
What have I done wrong or am I missing something here? I can't understand why it's not working... Here is the error.
λ git clone [email protected]:squizlabs/PHP_CodeSniffer.git
Cloning into 'PHP_CodeSniffer'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I also tried it like this and got this error:
λ git clone ssh://[email protected]:vuejs/vue.git
Cloning into 'vue'...
ssh: Could not resolve hostname github.com:vuejs: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
λ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Martins/.ssh/id_rsa): C:\Users\Martins\.ssh\id_rsa_github
Your identification has been saved in C:\Users\Martins\.ssh\id_rsa_github.
Your public key has been saved in C:\Users\Martins\.ssh\id_rsa_github.pub.
The key fingerprint is: SHA256:Zdkc0cerbea3ofgBLavgOLzfLm5JiFw2hZXQ41C0CY martins@MartinsPC
λ ssh-add C:\Users\Martins\.ssh\id_rsa_github
Identity added: C:\Users\Martins\.ssh\id_rsa_github (C:\Users\Martins\.ssh\id_rsa_github)
Host github
HostName github.com
User git
IdentityFile C:\Users\Martins\.ssh\id_rsa_github
Title: Martins PC
Key: ssh-rsa AAAAB3HkbB1yc2EAAADAQBAAABAQxbprOpXw7qD9dnb1PIeo8AZ5YxaTUQ8wjpiBGcvw3WjcXCotBLgSWilahLdPVouGjlAh0xB0YB1g3oMrAqQRHb54CDzWJMUWqatzMwL+xorVqPKuNAGVxWcvgWBooteX7D/XrrW5kjUooBM9ffTO2gpP3WcKBMdtjQDZJB0Ba6W/zNMF+1k2u2kq6m7z9QBspMIMqYJhc4YsmOr96JUTFb2Gn4ekJ5kJqW3L5m0UBzwj6WS0DczcgEKUy5r3fZ7sBHS7vhc3ZnNtpfzSpBbL+j/Mgvz8CC+xDGkjR/J/29m7nL martins@MartinsPC
Upvotes: 2
Views: 1433
Reputation: 3439
I finally found the problem. For anyone else who runs into this - the Host in my config file said "github" instead of "github.com". When I changed it to "github.com" now it is working.
It's still strange to me because I thought the Host section was for aliases only, maybe someone can explain that further.
Upvotes: 1