hexo-deployer-git icon indicating copy to clipboard operation
hexo-deployer-git copied to clipboard

Deploying the source files via `hexo-deployer-git`

Open cmp0xff opened this issue 5 years ago • 1 comments

Check List

Please check followings before submitting a new issue.

  • [x] I have already read Docs page & Troubleshooting page
  • [x] I have already searched existing issues and they are not help to me
  • [x] I examined error or warning messages and it's difficult to solve
  • [x] Using the latest version of Hexo (run hexo version to check)
  • [x] Node.js is higher than 8.6.0

Question

I would like to deploy the source files to an additional src branch so that I can maintain my website on different machines. I was basically following this answer on Stackoverflow. However, I got problem with permissions of a specific file. Only if I run $ hexo deploy with root privilege can I deploy the source successfully.

I cannot write a comment on Stackoverflow because I do not have sufficient reputation there. Also the person who wrote the answer seems not to be active since months ago.

Environment & Settings

Node.js & npm version

v13.8.0
6.13.7

Your site _config.yml (Optional)

deploy:
  - type: git
    repo: [email protected]:<username>/<username>.github.io.git
    branch: master
  - type: git
    repo: [email protected]:<username>/<username>.github.io.git
    branch: src
    extend_dirs: /
    ignore_hidden: false
    ignore_pattern:
        public: .

Your theme _config.yml (Optional)

Hexo and Plugin version(npm ls --depth 0)

[email protected] <local repo path>/<username>/<username>.github.io
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Your package.json package.json

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "4.2.0"
  },
  "dependencies": {
    "hexo": "^4.0.0",
    "hexo-deployer-git": "^2.1.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-index": "^1.0.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-marked": "^2.0.0",
    "hexo-renderer-stylus": "^1.1.0",
    "hexo-server": "^1.0.0"
  }
}

Others

If I run $ hexo deploy without root privilege, the error message reads

FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: EACCES: permission denied, copyfile '<local repo path>/<username>/<username>.github.io/.git/objects/06/3b27d8a4076d6f0748228cea43ffd963678206' -> '<local repo path>/<username>/<username>.github.io/.deploy_git/.git/objects/06/3b27d8a4076d6f0748228cea43ffd963678206'

cmp0xff avatar Feb 14 '20 07:02 cmp0xff

See also https://github.com/hexojs/site/issues/1456

stevenjoezhang avatar Mar 19 '20 12:03 stevenjoezhang

I will close this Issue, as the hexo-deployer-* plugins are meant for deploying website content only. Backing up blog source code should be achievable with a few simple git commands. For the problem you encountered, you might want to check if there are any issues with permission settings.

stevenjoezhang avatar Mar 30 '24 17:03 stevenjoezhang