hexojs / hexo-deployer-git

Git deployer plugin for Hexo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Added personal token in _config.yml but still can't access git

masterrite opened this issue · comments

I'm using the latest version of hexo-deployer-git but I can't access my repo. Here's the error:

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: unable to access 'https://github.com/*****.github.io/': The requested URL returned error: 403
FATAL { err:
   { Error: Spawn failed
       at ChildProcess.<anonymous> (F:\Hexo\node_modules\hexo-util\lib\spawn.js:52:19)
       at ChildProcess.emit (events.js:198:13)
       at ChildProcess.cp.emit (F:\Hexo\node_modules\cross-spawn\lib\enoent.js:40:29)
       at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) code: 128 } } 'Something\'s wrong. Maybe you can find the solution here: %s' 'https://hexo.io/docs/troubleshooting.html'

Here's the _config.yaml for deployer:

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repository: https://github.com/*****.github.io
  branch: master
  token: ghp_*****

Figured it out thanks to @zcsheng95: hexojs/hexo#4757 (comment).

However, this isn't is fix from hexo-deployer-git's side. It'd be nice to update the plugin.

hexojs/hexo#4757 (comment) is right , you need add your username to the url, like this https://oauth2:ghp_********@github.com/yourusername/yourusername.github.io, it's work for me