无法弄清楚如何使用Github作为VuePress站点源代码控制和deploying it to Github Pages的工作流程。
当我第一次运行deploy.sh
时,它在init
命令周围给了我一个Github证书错误并且没有初始化一个新的repo(我已经有一个repo设置所以不确定init
中的deploy.sh
命令是否是必需的。后续运行的deploy.sh
结果没有错误。
**问题:**不幸的是,当我访问my Github Pages site时,它没有使用VuePress模板。
我觉得我有: - 文件夹结构错误 - base
在config.js
中设置错误 - 相关文件夹在deploy.sh
中不正确
有人可以关注这个并给出一些反馈吗?谢谢。
供你参考
本地机器的文件夹结构:
user@system:~/powerDocs$ tree
.
├── deploy.sh
├── docs
│ └── README.md
├── node_modules
│ └── yarn
│ ├── bin
│ │ ├── yarn
│ │ ├── yarn.cmd
│ │ ├── yarn.js
│ │ ├── yarnpkg
│ │ └── yarnpkg.cmd
│ ├── lib
│ │ ├── cli.js
│ │ └── v8-compile-cache.js
│ ├── LICENSE
│ ├── package.json
│ └── README.md
├── package.json
├── package-lock.json
└── README.md
5 directories, 15 files
deploy.sh
的内容:
#!/usr/bin/env sh
# abort on errors
set -e
# build
vuepress build
# navigate into the build output directory
cd docs/.vuepress/dist
# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# if you are deploying to https://<USERNAME>.github.io
# git push -f [email protected]:SeaDude/SeaDude.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push -f [email protected]:SeaDude/powerDocs.git master:gh-pages
cd -
我用chmod +x deploy.sh
创建了deploy.sh可执行文件。运行./deploy.sh
给我以下输出:
user@system:~/powerDocs$ ./deploy.sh
WAIT Extracting site metadata...
[12:05:53 PM] Compiling Client
[12:05:53 PM] Compiling Server
(node:15590) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[12:05:57 PM] Compiled Server in 3s
[12:05:59 PM] Compiled Client in 6s
WAIT Rendering static HTML...
DONE Success! Generated static files in .vuepress/dist.
Reinitialized existing Git repository in /home/powerDocs/docs/.vuepress/dist/.git/
On branch master
nothing to commit, working directory clean
这是config.js
的内容:
module.exports = {
title: "PowerDocs",
description: "Where functions go to frolic.",
base: "/powerDocs/",
themeConfig: {
nav: [
{ text: "Home", link: "/" }
],
sidebar: [
'/'
]
}
};
你检查了你的dist
文件夹,看看实际输出的是什么?该错误使得在构建之后似乎没有要提交的文件。
我在本地有几乎相同的设置,并没有遇到这个问题,唯一的区别是我运行构建的命令是yarn docs:build