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

相关推荐
Mo_YuO.o3 小时前
工作区 暂存区 版本库
git·gitee·github
深念Y3 小时前
本地Git仓库推送到Gitee教程
git·gitee·github·仓库·项目·源代码管理·初始化
白云千载尽4 小时前
a800上gazebo无法使用gpu的问题修复
网络·git·github
petunsecn10 小时前
多 GitHub 账号与多平台 Git 使用(附加场景:就想用指定账号clone)
git·github
陈希瑞11 小时前
GitHub Skill Forge 深度解析:把任意 GitHub 仓库一键锻造成 AI 可调用“技能包”
人工智能·github
编程武士11 小时前
Github 开源项目 Spec Kit 介绍:让你的 Vibe Coding 更加稳定
github·vibecoding
CoderJia程序员甲11 小时前
GitHub 热榜项目 - 日榜(2026-01-23)
人工智能·ai·大模型·github·ai教程
Ms.AG11 小时前
GitHub 学生认证(保姆级教学)
vscode·github
forestsea11 小时前
GitHub HTTPS 提交代码与个人访问令牌配置指南
网络协议·https·github
寻道码路12 小时前
【GitHub周榜】Agno:快速构建多模态智能体的轻量级框架,开发提速 10000 倍
人工智能·语言模型·开源·github·aigc·ai编程