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

相关推荐
粤M温同学1 小时前
VS Code GitHub Copilot插件中配置 DeepSeek 模型
github·copilot
csdn_aspnet3 小时前
开源项目在GitHub上的破圈方法论,解析Star增长、Issue响应、Contributor引导等真实运营技巧
开源·github·issue·readme·star
uhakadotcom4 小时前
Scrapy-Redis 里面提供哪些即开即用的功能能力模块
前端·面试·github
诚信定制8394 小时前
GitHub 三大协作利器:Topics标签、Discussions与Actions Marketplace
github
欣慰的猫咪6 小时前
GitHub Copilot 正式成为 JetBrains AI Assistant 的原生默认 Agent 之一
人工智能·github·copilot
鲸~屿6 小时前
Git上传本地文件到GitHub教学指南
git·github
贾天佑忆月7 小时前
Mac 本地项目推送至 GitHub 完整指南
elasticsearch·macos·github
码流怪侠19 小时前
【GitHub】Strix 深度解析:开源 AI 渗透测试工具的架构、原理与实战
github·agent·ai编程
OpenTiny社区1 天前
Coding Agent 到底是怎么工作的,它又为什么会在复杂代码库里失真?
前端·github·agent