报错
暑假的时候,我搭建了一个github page
来记录一些非计算机内容。搭建过程见:使用hexo+github搭建个人博客
今天写完内容,源文件内容同步到分支,生成内容却无法部署到masters,错误如下。
hexo d
Username for 'https://github.com': da1234cao
Password for 'https://da1234cao@github.com':
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: 'https://github.com/da1234cao/da1234cao.github.io/' 鉴权失败
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (/home/dacao/exercise/da1234cao.github.io/node_modules/hexo-util/lib/spawn.js:51:21)
at ChildProcess.emit (events.js:400:28)
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
错误处理
我仔细的在网上找了找。原因是"从21年8月13后不再支持用户名密码的方式验证"。而,我的hexo deploy
部署,一直需要输入账号密码。
参考: 解决remote: Support for password authentication was removed on August 13, 2021. Please use a perso
我们生成自己的token,重新拉取仓库。
git clone <TOKEN>git@github.com:da1234cao/da1234cao.github.io.git
rm -rf node_modules && npm install --force
npm audit fix
hexo clean && hexo g
可是,hexo deploy
部署的时候,还是需要输入密码。参考忽然发现GitHub用不了了…,我们在输入密码的地方粘贴上我们的token,可以成功部署。
原来输入密码的时候,输入生成的token就可以了
Username: your_username
Password: your_token
本质问题没有解决
上面虽然提交了,可以看我的新笔记:毛泽东语录-1。
但是,本质问题没有解决:hexo d
如何免密部署?
首先我的ssh
必然是没有问题。因为,平常我也使用这对公私钥同步仓库。
ssh -T git@github.com
Hi da1234cao! You've successfully authenticated, but GitHub does not provide shell access.
其次,我的_config.fluid.yml
配置也应该没有问题。
deploy:
type: git
repo: git@github.com:da1234cao/da1234cao.github.io.git
branch: master
问题解决了~
就在我整理这篇博客的时候,我突然意识到什么~
我记得当时替换默认主题的时候,是将_config.yml
修改完成,然后复制了一份为_config.fluid.yml
。
之后,我修改_config.fluid.yml
的deploy配置,如上一节所示。但是,我没有同样修改_config.yml
。
所以,我现在修改_config.yml
,再次和_config.fluid.yml
相同。然后顺利部署。
➜ da1234cao.github.io git:(doc) ✗ hexo deploy
INFO Validating config
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
位于分支 master
无文件要提交,干净的工作区
分支 'master' 设置为跟踪来自 'git@github.com:da1234cao/da1234cao.github.io.git' 的远程分支 'master'。
Everything up-to-date
INFO Deploy done: git
那_config.yml
和_config.fluid.yml
有什么关系呢?似乎起作用的是_config.yml
,_config.fluid.yml
有仅起到当前主题的备份作用。是这样么?暂时不管,工具能用就行。