解决HEXO Git部署时报错:Permission denied (publickey)
李
2019-04-02 19:45:12
上海
平台:Win10
很久没有更新文章了,断更期间还重装了系统:D
于是乎今天用HEXO部署文章时报错了:
Permission denied (publickey)
错误原因就是字面意思,SSH Key没有配置好。
首先在Git Bash中检查是否有SSH Key:
$ ssh -T git@github.com
git@github.com: Permission denied (publickey).
嗯,没有。
那就新建一个吧:
$ ssh-keygen -t rsa -C "example@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/xiaoming/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/xiaoming/.ssh/id_rsa.
Your public key has been saved in /c/Users/xiaoming/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:pdmmm0dTm/sssss5xoPmY82FCHznLngEbC5iEtpKkba example@qq.com
The key's randomart image is:
+---[RSA 2048]----+
|o.. . o.o |
|o+.. . + . |
|ooo o + |
|Eo B = * |
|. S = = o |
| o # * o |
| O / * |
| . * = . |
| |
+----[SHA256]-----+
执行过程中要求输入口令,直接回车就好,无伤大雅。然后登录GitHub在账户的设置中找到SSH and GPG keys
,点击New SSH Key
新建SSH Key,将c/Users/xiaoming/.ssh/id_rsa.pub
文件内的公钥粘贴进去即可。
再次检查:
$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
Hi Xiaoming! You've successfully authenticated, but GitHub does not provide shell access.
OK,再次部署就成功了。