部署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. 发布成功 例如我的

相关推荐
uhakadotcom16 分钟前
了解 psycopg2 连接池
后端·面试·github
uhakadotcom18 分钟前
Python JSON 库性能对比:json vs orjson
后端·面试·github
1_2_3_1 小时前
深入理解 Git 子模块:优化项目管理的利器
前端·github
掉头发的王富贵3 小时前
受不了github的网络限制了,我开源了一个图床工具 gitee-spring-boot-starter
spring boot·后端·github
uhakadotcom4 小时前
Turborepo:提升Monorepo项目构建效率的利器
后端·面试·github
uhakadotcom4 小时前
Python 列表添加元素:`append()` 和 `extend()` 的区别
后端·面试·github
ZZQ-ZZQ6 小时前
版本控制工具——Git
git·gitee·github·版本控制·gitea
xinxiyinhe15 小时前
Github最新AI工具汇总2025年4月份第2周
人工智能·github
lzq60316 小时前
5分钟上手GitHub Copilot:AI编程助手实战指南
github·copilot·ai编程
狼哥IKOO18 小时前
AI 终端模拟器 Python 脚本
后端·设计模式·github