Github出现Permission denied (publickey)
发布日期:2024-08-30 作者:svygh123 分类:文章
ssh克隆github项目报错Permission denied。
ssh克隆github项目报错Permission denied
D:\soft\src>git clone git@github.com:svygh123/srchome.git
Cloning into 'srchome'...
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.
D:\soft\src>git clone git@github.com:svygh123/srchome.git
Cloning into 'srchome'...
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.
验证Key
Administrator@PC-20221205RLEH MINGW64 /
$ ssh -T git@github.com
git@github.com: Permission denied (publickey).
重新生成ssh key
Administrator@PC-20221205RLEH MINGW64 /
$ ssh-keygen -t rsa -b 4096 -C "357228560@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa
Your public key has been saved in id_rsa.pub
The key fingerprint is:
SHA256:CA7vEP7gBKYvNm6w0kWHkJh1fKnkZuQaUSmSxcNkTJw 357228560@qq.com
The key's randomart image is:
+---[RSA 4096]----+
| &*=o. . |
|=.E.= o |
|.ooX.+ |
|oo.=O... |
|. =*o.. S |
|.+.=. |
|o=o.o |
|=oo |
|o. |
+----[SHA256]-----+
重新验证
Administrator@PC-20221205RLEH MINGW64 /
$ ssh -T git@github.com
git@github.com: Permission denied (publickey).
最后验证通过
Administrator@PC-20221205RLEH MINGW64 /
$ ssh -T git@github.com
Hi svygh123! You've successfully authenticated, but GitHub does not provide shell access.
生成前,需要设置账户和邮箱
git config --global user.name "svygh123"
git config --global user.email "357228560@qq.com"
生成时,需要注意名称
生成时,名称为id_rsa和id_rsa.pub,位置C:/Users/Administrator/.ssh
Github加入SSH key
settings --> SSH and GPG keys --> New SSH key
Title随意起名,Key填入id_rsa.pub内容
您可能感兴趣的文章:
联系我:357228560@qq.com