部署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 git@github.com:<USERNAME>/<USERNAME>.github.io.git master
   
   # 部署到 https://<USERNAME>.github.io/<REPO>
   # 将下面这行替换成自己的仓库地址
   git push -f git@github.com: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. 发布成功 例如我的

相关推荐
CoderJia程序员甲9 小时前
GitHub 热榜项目 - 日榜(2025-10-11)
ai·开源·github·ai编程·github热榜
CoderJia程序员甲12 小时前
GitHub 热榜项目 - 日榜(2025-10-14)
ai·开源·大模型·github·ai教程
逛逛GitHub15 小时前
又发现 4 个有趣的 GitHub 开源 MCP。
github
whysqwhw16 小时前
KuiklyUI Core 关键技术点与架构设计分析
github
whysqwhw16 小时前
KuiklyUI Core模块代码架构设计全面分析
github
运营猫小海豚17 小时前
低代码+强推理:开源工具链如何让企业项目管理效率翻倍
github
MicrosoftReactor18 小时前
技术速递|使用 GitHub Copilot Agent 模式现代化 Java 项目的分步指南
java·github·copilot
mzlogin19 小时前
清除 GitHub 上的幽灵通知
github
程序员爱钓鱼21 小时前
Python编程实战 · 基础入门篇 | Python能做什么
后端·python·github
xxxcq1 天前
Go微服务网关开发(3):负载均衡功能的实现
后端·github