1、问题

​ 在hexo d之后,出现如下代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ERROR: Permission to gugeshenjineng/gugeshenjineng.github.io.git denied to googleshenjineng.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (G:\blog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (events.js:375:28)
at ChildProcess.cp.emit (G:\blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

2、解决方法

(1)检查是否有SSH key

​ 登录GitHub,点击头像。在SSH and GPG keys,查看是否有ssh keys.请自行判断自己的情况,有的话请直接跳到第(3)步;如果没有,请继续。

(2) 新建SSH key, 在git bash 窗口输入:

1
ssh-keygen -t rsa -C "邮箱名"

​ 然后会出现:

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/dell/.ssh/id_rsa):

​ 直接回车就可以,然后会出现:

1
2
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

请注意,在这里要输入密码,然后在点击回车。(这个密码会在你提交项目时使用,如果为空的话提交项目时则不用输入。这个设置是防止别人往你的项目里提交内容)

注意:输入密码的时候没有*字样的,直接输入就好。

​ 然后就会出现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Your identification has been saved in /c/Users/dell/.ssh/id_rsa.
Your public key has been saved in /c/Users/dell/.ssh/id_rsa.pub.
The key fingerprint is:
65:69:······02:4b emailname@email.com
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . o . |
| . o o = o |
| . o * = o |
| E o + o . |
| . o. . . |
| .. |
+-----------------+

​ 至此,密钥已经成功生成。、

(3) 在GitHub上添加ssh key:

​ 1) 打开本地文件夹,在C盘用户 .ssh文件夹里,id_rsa.pub,可以将这个文件在编辑器中打开,然后全选复制

​ 2)登录GitHub,在设置里的ssh and gpg keys这里新建ssh key

​ 3) 将1)中的复制内容粘贴在文本框里,title随便写

(4)测试是否设置成功:

1
ssh -T git@github.com

​ 有可能出现两种情况:

​ 第一种:

1
2
3
The authenticity of host 'github.com (192.30.252.1)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

​ 第二种:

1
2
3
The authenticity of host 'github.com (192.30.252.1)' can't be established.
RSA key fingerprint is nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?

​ 这种情况下,直接yes 回车,然后会出现:

1
2
Hi username! You've successfully authenticated, but GitHub does not 
provide shell access.

​ 也可能在 ssh -T git@github.com之后,直接出现的就是这个,我就是这样

(5)设置用户信息

1
2
git config --global user.name "用户名"
git config --global user.email "你希望的邮箱名"

(6)然后就可以部署你的博客到github

​ 其他问题待补充

参考文章:https://www.cnblogs.com/xsilence/p/6001938.html