一、Hexo配置服务器单独部署 1 2 3 4 5 6 7 ---_config.yml配置文件中设置如下代码: deploy: type: git repo: git@zhangdong.me:hexo.git branch: master
二、Hexo配置服务器和github部署 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ---配置服务器和github部署 deploy: type: git repo: - git@zhangdong.me:hexo.git - https://github.com/soxo/hexo.git branch: - master 或 deploy: - type: git repo: git@zhangdong.me:hexo.git branch: master - type: git repo: https://github.com/soxo/hexo.git branch: gh-pages 或 deploy: # - type: git # id_rsa_hexohub.pub # repo: git@hexohub.github.com:hexohub/hexohub.github.io.git # branch: main - type: git # id_rsa_soxo.pub repo: git@github.com:soxo/soxo.github.io.git branch: gp-pages - type: git # default id_rsa.pub repo: git@zhangdong.me:hexo.git branch: master
代码部署在GitHub上首先需要在本地通过ssh-keygen -t rsa生成id_rsa.pub密钥,复制密钥,然后登录github,在设置—SSH and GPG keys---New SSH key,将公有密钥粘贴进去,最后点Add-SSH-key
三、Hexo配置本地代码上传至github 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ---手工备份本地代码上传到github C:\Users\admin>cd hexo C:\Users\admin\hexo>git add . C:\Users\admin\hexo>git commit -m "delete" [main 6aecc7f] delete 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 dfd .txt C:\Users\admin\hexo>git push -u origin main 参考: …or create a new repository on the command line echo "# example" >> README.md git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/soxo/example.git git push -u origin main …or push an existing repository from the command line git remote add origin https://github.com/soxo/example.git git branch -M main git push -u origin main