This is a post about how to install Hexo on server and pull the repository to github.

# Install hexo on server

# Create a conda environment

h
$ conda create -n hexo-env

# Install dependent packages

h
$ conda activate hexo-env
$ conda install -c conda-forge nodejs
$ conda install -c conda-forge git

# Install hexo

h
$ npm install -g hexo-cli
$ npm install hexo-deployer-git --save

# Set git config and ssh key

h
$ git config --global user.name "github user name"
$ git config --global user.email "github user email"
$ ssh-keygen -t rsa -C "github user email"
# then copy the content of id_rsa.pub, save as a ssh key of github account
# check the connection to github
$ ssh git@github.com

# Init hexo website

h
# cd /path to website directory/
$ hexo init
$ npm install
$ hexo g # generate static files
$ hexo s # start a local server, should check the port number
$ hexo d # deploy website

# Issues

⚠️ Error

fatal: unable to access 'https://github.com/example/website/': OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0
FATAL {
  err: Error: Spawn failed
      at ChildProcess.<anonymous> (/example/website/node_modules/hexo-util/lib/spawn.js:51:21)
      at ChildProcess.emit (node:events:513:28)
      at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
    code: 128
  }
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

🔧 Solution

$ hexo config deploy.repository git@github.com:[github name]/[repository]

Reference1
Reference2