hexo+github+cloudflare

  • Domain github.io or pages.dev

  • GitHub

  • Cloudflare

  • vscode install

  • nodejs install
    win+R

    1
    2
    node -v
    npm config set registry https://mirrors.huaweicloud.com/repository/npm/
    1
    Set-ExecutionPolicy RemoteSigned
    1
    sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
  • git install

  • git bash

    1
    2
    3
    git config -l  //查看所有配置
    git config --system --list //查看系统配置
    git config --global --list //查看用户(全局)配置

    设置用户

    1
    2
    git config --global user.name username
    git config --global user.email user@email.com
  • key

    1
    ssh-keygen -t rsa -C user@email.com

    c:/用户/.ssh
    id_rsa - 私
    id_rsa.pub - 公
    GitHub右上角头像→settings→ssh and gpg keys→new ssh key
    title hexo专用
    key id_rsa.pub
    测试连接

    1
    ssh -T git@github.com

    Are you sure you want to continue connecting (yes/no/[fingerprint])?

  • 创建github.io
    +→new repository→username.github.io→public→create repository

  • PC
    c:hexo-blog→git bash

    1
    npm install -g hexo-cli && hexo -v

    初始化hexo

    1
    2
    3
    4
    hexo init blog
    cd blog
    npm i
    hexo cl && hexo s
  • 挂载到github pages
    hexo-deployer-git install

    1
    npm install hexo-deployer-git --save

    _config.yml

    1
    2
    3
    4
    deploy:
    type: git
    repository: git@github.com:username/username.github.io.git
    branch: main

hexo clean:删除之前生成的文件,可以用hexo cl缩写。
hexo generate:生成静态文章,可以用hexo g缩写
hexo deploy:部署文章,可以用hexo d缩写


hexo+github+cloudflare
http://example.com/2025/05/23/hexo-github-cloudflare/
作者
Gang
发布于
2025年5月23日
许可协议