hexo-deployer-git以token方式部署到Github

2022-01-18 17:29:36 浏览数 (1)

记hexo-deployer-git远程CI部署踩坑

翻车写法

官方文档中关于config.yml写法

代码语言:javascript复制
# You can use this:
deploy:
  type: git
  repo: <repository url>
  branch: [branch]
  token: ''
  message: [message]
  name: [git user]
  email: [git email]
  extend_dirs: [extend directory]
  ignore_hidden: false # default is true
  ignore_pattern: regexp  # whatever file that matches the regexp will be ignored when deploying

此时会因为程序读不到token而导致密钥验证失败报错

代码语言:javascript复制
Logon failed, use ctrl c to cancel basic credential prompt.
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/useblue/blog-ifibe.com.git/'
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed

勉强能跑写法

代码语言:javascript复制
deploy:
  type: git
  repo:
    github:
      url: <repository url>
      branch: [branch]
      token: ''
  message: [message]
  name: [git user]
  email: [git email]
  extend_dirs: [extend directory]
  ignore_hidden: false # default is true
  ignore_pattern: regexp  # whatever file that matches the 

使用token验证时使用HTTPS方式

0 人点赞