This commit is contained in:
xugaoyi 2019-12-09 12:07:24 +08:00
parent 74a2c10eb9
commit 4f0583a334
4 changed files with 69 additions and 33 deletions

View File

@ -2,7 +2,7 @@
## 介绍
使用 [VuePress](https://v1.vuepress.vuejs.org/zh/guide/) 创建 SEO 友好的静态博客站。一键发布到 GitHub Pages内置 `deploy.sh` 和 [GitHub Action](https://github.com/features/actions) 两种自动部署脚本。
使用 [VuePress](https://v1.vuepress.vuejs.org/zh/guide/) 构建 SEO 友好的静态博客站。内置 `deploy.sh` 和 [GitHub Action](https://github.com/features/actions) 两种自动部署脚本,一键发布到 GitHub Pages
@ -26,7 +26,7 @@ npm run dev # or yarn dev
#### 3、编辑
编辑或新增 \*.md文件以及修改 `docs/.vuepress/config.js` 中的 nav 导航栏等信息(具体可查看 [VuePress](https://v1.vuepress.vuejs.org/zh/guide/) 文档),需重新运行·`npm run dev`并刷新浏览器查看更
编辑或新增 \*.md文件以及修改 `docs/.vuepress/config.js` 中的 nav 导航栏等信息(具体可查看 [VuePress](https://v1.vuepress.vuejs.org/zh/guide/) 文档),需重新运行·`npm run dev`并刷新浏览器查看更
#### 4、部署
@ -34,7 +34,7 @@ npm run dev # or yarn dev
##### 1、使用deploy.sh脚本部署
第一步修改deploy.sh脚本内的仓库地址为你的仓库如有自定义域名则一并修改没有则注释
第一步,修改`deploy.sh`脚本内的仓库地址为你的仓库,如有自定义域名则一并修改,没有则注释
```bash
# 如果是发布到自定义域名
@ -47,7 +47,7 @@ echo 'www.evanblogweb.com' > CNAME
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
```
第二步,执行如下命令
第二步,一键部署命令
```bash
npm run deploy # 运行部署脚本deploy.sh,并发布到仓库的gh-pages分支
@ -102,7 +102,7 @@ npm run deploy # 运行部署脚本deploy.sh,并发布到仓库的gh-pages分支
* 进入解析页面后,点击`添加记录`。填入,记录类型:`CNAME`,主机记录:`www`解析线路默认记录值你的github pages地址`<userName>.github.io`TTL默认的10分钟确定。
![](https://raw.githubusercontent.com/xugaoyi/image_store/master/blogdns2.png)
![dns2](https://raw.githubusercontent.com/xugaoyi/image_store/master/blogdns2.png)
#### 3、使github pages与域名关联
@ -130,7 +130,7 @@ npm run chame
## 提示
#### md的yaml代码
#### md文件的yaml代码
必须放在 md 文件在最上方才能生效

View File

@ -20,7 +20,8 @@ module.exports = [
{text: 'Markdown使用教程', link: '/other/markdown'},
{text: 'npm使用教程', link: '/other/npm'},
{text: '学习网站分享', link: '/other/study'},
{text: '面试问答集锦', link: '/other/interview'}
{text: '面试问答集锦', link: '/other/interview'},
{text: '关于本博客搭建', link: 'https://github.com/xugaoyi/evanblog'},
]},
{text: '关于我',link: '/about/'}
]

35
docs/other/baidushoulu.md Normal file
View File

@ -0,0 +1,35 @@
# 解决百度爬虫无法爬取搭建在GitHub上的个人博客的问题
## 背景
由于GitHub禁止百度爬虫访问造成托管在GitHub Pages上的博客无法被百度收录。相关问题可以通过百度站长平台的抓取诊断再现每次都是403 Forbidden的错误…
## 解决方案
将博客同时同步托管到GitHub Pages和[coding.net](https://coding.net/)上,解决百度不收录问题。
步骤:
1、注册[coding.net](https://coding.net/)账号
2、创建一个跟账号用户名同名的仓库例如https://e.coding.net/username/username.git
3、配置 SSH 公钥,配置方法请查看[帮助](https://help.coding.net/docs/project/features/ssh.html)
4、在终端下进入本地博客目录evanblog假设目录名为evanblog添加coding.net的远程地址并且新建分支。
```bash
cd evanblog
git remote add coding https://e.coding.net/username/username.git
git checkout -b coding-pages
git checkout master
git branch
> coding-pages
> * master
git push coding master/coding-pages
```
> 关于git操作可查阅[Git使用文档](./git.md)

View File

@ -2,7 +2,7 @@
# Git使用文档
### 安装
## 安装
官网下载:<https://git-scm.com/downloads> 下载完成后使用默认进行安装。
@ -18,7 +18,7 @@ git config --global user.email "email@example.com"
### 创建版本库(仓库)
## 创建版本库(仓库)
```bash
# 创建仓库
@ -38,7 +38,7 @@ git init
### 添加文件到仓库
## 添加文件到仓库
在仓库目录下放入文件,如新建一个`test.txt`文件,然后使用`git add test.txt`命令告诉Git把文件添加到缓存区然后使用`git commit -m "提交描述"`告诉Git把文件提交到仓库。
@ -56,7 +56,7 @@ git commit -m "提交描述"
##### 提交描述规范
#### 提交描述规范
在提交代码时输入清晰的说明有利于版本管理,建议搭配如下关键字编写提交描述
@ -75,9 +75,9 @@ git commit -m "提交描述"
### 版本管理
## 版本管理
##### 提交修改
#### 提交修改
如修改`test.txt`的内容后,运行`git status`命令看看被修改的文件,然后再使用`git add test.txt`、
`git commit -m "修改描述"`把修改后的文件提交到仓库,提交后可再次使用`git status`查看当前状态。
@ -89,7 +89,7 @@ git status
##### 查看版本记录
#### 查看版本记录
```bash
# 查看版本记录
@ -101,7 +101,7 @@ git log # 显示版本号、提交时间等信息
##### 回退版本
#### 回退版本
首先Git必须知道当前版本是哪个版本在Git中用`HEAD`表示当前版本也就是最新的提交1094adb...注意我的提交ID和你的肯定不一样上一个版本就是`HEAD^`,上上一个版本就是`HEAD^^`当然往上100个版本写100个^比较容易数不过来,所以写成`HEAD~100`。
@ -123,19 +123,19 @@ git reset --hard <版本号前几位>
git reflog
```
##### 撤销修改
#### 撤销修改
<https://www.liaoxuefeng.com/wiki/896043488029600/897889638509536>
##### 删除文件
#### 删除文件
https://www.liaoxuefeng.com/wiki/896043488029600/900002180232448
### 远程仓库
## 远程仓库
##### SSH验证
#### SSH验证
使本机能关联远程仓库首次需要SSH验证
@ -152,7 +152,7 @@ ssh-keygen -t rsa -C "邮件地址"
##### 关联远程仓库
#### 关联远程仓库
SSH验证完成后在github创建仓库创建仓库时记得取消 `Initialize this repository with a README`的勾选,然后在本地命令:
@ -191,7 +191,7 @@ git push
##### 查看远程仓库
#### 查看远程仓库
```bash
# 查看远程仓库
@ -200,7 +200,7 @@ git remote -v
##### 删除远程仓库
#### 删除远程仓库
```bash
# 删除远程仓库
@ -209,14 +209,14 @@ git remote rm <仓库名>
##### 从远程库克隆项目
#### 从远程库克隆项目
```bash
# 从远程库克隆项目
git clone <仓库地址>
```
###### 克隆指定分支
##### 克隆指定分支
```bash
# 克隆指定分支
@ -225,9 +225,9 @@ git clone -b <分支名> <仓库地址>
### 分支管理
## 分支管理
##### 创建分支
#### 创建分支
```bash
# 创建分支
@ -236,7 +236,7 @@ git checkout -b <分支名>
##### 查看分支
#### 查看分支
```bash
# 查看分支
@ -247,7 +247,7 @@ git branch
##### 切换分支
#### 切换分支
```bash
# 切换分支
@ -256,7 +256,7 @@ git checkout <分支名>
##### 合并分支
#### 合并分支
```bash
# 合并分支
@ -267,7 +267,7 @@ git merge <分支名>
##### 删除分支
#### 删除分支
```bash
# 删除分支
@ -276,7 +276,7 @@ git branch -d <分支名>
##### 修改分支名
#### 修改分支名
```bash
# 修改分支名
@ -287,7 +287,7 @@ git branch -m <原分支名> <新分支名>
### 帮助命令
## 帮助命令
如对命令不清楚时,可使用`git help`命令显示出git命令介绍。
@ -395,7 +395,7 @@ collaborate (参见命令: git help workflows)
### 参考文档
## 参考文档
<https://www.liaoxuefeng.com/wiki/896043488029600>