【发布时间】:2019-02-07 10:15:58
【问题描述】:
无法弄清楚将 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 git@github.com:SeaDude/SeaDude.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push -f git@github.com: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: [
'/'
]
}
};
【问题讨论】:
标签: github github-pages vuepress