我正在尝试克隆github存储库,但这给了我这个错误。 (我在 Windows 上使用 cmder bash)
我做错了什么,或者我在这里想念什么?我不明白为什么它不起作用...这是错误。
λ git clone git@github.com:squizlabs/PHP_CodeSniffer.git
Cloning into 'PHP_CodeSniffer'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我也这样尝试过并收到此错误:
λ git clone ssh://git@github.com: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
答案 0 :(得分:1)
我终于找到了问题。对于遇到此问题的其他人-我的配置文件中的主机说“ github”,而不是“ github.com”。当我将其更改为“ github.com”时,它可以正常工作。
对我来说仍然很奇怪,因为我认为“主机”部分仅用于别名,也许有人可以进一步解释。