部署 hexo deploy 实现自动推送到github仓库

hexo deploy

我一开始用 hexo deploy 的时候出现了一个问题:
输入用户名,密码后

remote: Support for password authentication was removed on August 13, 2021.

我查看了我的 _config.yml 配置

deploy:
  type: git
  repo: https://github.com/XXX
  branch: main
  token: your taken

后来我将 repo 这一行修改为

repo: git@github.com:XXX

就不用输密码了。
可能是我本地配置过 ssh 的原因吧,修改完开袋即食了。

仍然使用 hhtps

如果仍然使用 hhtps 的话,去复制上面配置里的 token
然后在输入账号密码时,改为输入

Username for 'https://github.com': YourName
Password for 'https://YourName@github.com': YourTaken

怎么获取 token

Settings->Developer settings->Personal access tokens->Personal access tokens 生成一个

参考

https://www.imooc.com/article/4433
https://blog.csdn.net/qq_21040559/article/details/122621179

Sow nothing, reap nothing.
Built with Hugo 主题 StackJimmy 设计