部署vuepress项目到githubPage

部署vuepress项目到githubPage

1. 项目文件夹下有两个分支(main和gh-page)

1.1 main分支存放项目代码

1.2 gh-page分支存放 npm run docs:build之后的dist里面的所有文件

2. 分别提交到github上

3. 你的项目/docs/.vuepress/config.js

复制代码
   module.exports = {
     title: 'vuePress',
     description: 'VuePress GitHub Actions',
     base: '/yt-ui-doc/', // 必须配置正确
     repo: 'https://programmermao-001.github.io/yt-ui-doc/', // 远程仓库地址
     plugins: [
   	'vuepress-plugin-mermaidjs'
     ],
     themeConfig: {
       // ...
     }
   }

4. 你的项目/deploy.sh

复制代码
   #!/usr/bin/env sh
   
   # 当发生错误时中止脚本
   set -e
   
   # 构建
   npm run build
   
   # cd 到构建输出的目录下
   cd dist
   
   # 部署到自定义域域名
   # echo 'www.example.com' > CNAME
   
   git init
   git add -A
   git commit -m 'deploy'
   
   # 部署到 https://<USERNAME>.github.io
   # git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master
   
   # 部署到 https://<USERNAME>.github.io/<REPO>
   # 将下面这行替换成自己的仓库地址
   git push -f [email protected]:ProgrammerMao-001/yt-ui-doc.git master:gh-pages   
   cd -

5. 上github.com找到自己的项目

5.1 Settings

5.2 Pages

5.3 Branch 选择 gh-page分支 / (root)文件夹

5.4 保存

6. 发布成功 例如我的

相关推荐
Yvonne爱编码4 小时前
CSS- 4.1 浮动(Float)
前端·css·html·github·html5·hbuilder
冷yan~5 小时前
GitHub文档加载器设计与实现
java·人工智能·spring·ai·github·ai编程
qianmoQ2 天前
GitHub 趋势日报 (2025年05月14日)
github
Yvonne爱编码2 天前
CSS- 2.1 实战之图文混排、表格、表单
前端·css·html·github·状态模式·html5·hbuilder
qianmoQ2 天前
GitHub 趋势日报 (2025年05月11日)
github
Yvonne爱编码2 天前
HTML-3.3 表格布局(学校官网简易布局实例)
前端·html·github·html5·hbuilder
范纹杉想快点毕业2 天前
以项目的方式学QT开发(一)——超详细讲解(120000多字详细讲解,涵盖qt大量知识)逐步更新!
c语言·数据结构·c++·git·qt·链表·github
tonngw2 天前
【Mac 从 0 到 1 保姆级配置教程 12】- 安装配置万能的编辑器 VSCode 以及常用插件
git·vscode·后端·macos·开源·编辑器·github
八股文领域大手子2 天前
HTTP/1.1 host虚拟主机详解
github
HORSE RUNNING WILD3 天前
解决 PicGo 上传 GitHub图床及Marp中Github图片编译常见难题指南
css·python·github