Hexo重新布置到github出错

本来在github上部署的,可是因为速度慢,转战到gitee上了。然而两年中一直写技术文章没有问题。可是因为看了网络小说,想写出一些糟点,因为有点儿关键字,总是不给更新。一气之下,决定转回github,然而竟然部署失败了……

1
2
3
4
5
6
7
8
9
fatal: 'https://github.com/你的用户名/你的用户名.github.io.git/' 鉴权失败
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (/home/主目录名/myblog/node_modules/hexo-util/lib/spawn.js:51:21)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
  1. 反复登录用户名,与密码,木有错误。然而还是失败

  2. ssh的密钥重新生成,并重新更新在github上,确认没有错。然而还是失败

    然后百度搜索了“鉴权失败”那一行,给出的解决办法
  3. 进入github.com我的主页里,

    setting

    Developer settings

    Personal access tokens

    new access tokens

的时候有个时间选择,可以选择某个时间长度(一个月、三个月什么的,因为我个人用的就选择的永不过期),然后创建成功后会有个token,把它当作密码,在你重新推送你项目的时候,命令行提示你输入邮箱和密码的时候,把这个token当密码输入(复制即可)。满决欢喜的试,然而还是失败了。当时陷入误区,还反复试了三遍!!!

以为没有半法了,过了三天,才想起来百度 hexo的错误代码。给出试错
  1. 以下方法。还是失败了

    1
    2
    3
    4
    $ cd myblog
    $ rm -rf .deploy_git
    $ git config --global core.autocrlf false #把git加入系统环境变量
    $ hexo clean & hexo g & hexo d
  2. 再查,以下方法成功了

    1
    2
    $ cd myblog
    $ vim _config.yml #到最后几行
    1
    2
    3
    4
    5
    6
    7
    8
    # Deployment
    ## Docs: https://hexo.io/docs/one-command-deployment
    deploy:
    type: git
    repo: https://github.com/YourName/YourName.github.io.git(不要使用这个)
    git@github.com:YourName/YourName.github.io.git(用这个)
    branch: master
    $ hexo clean & hexo g & hexo d