-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
91 lines (76 loc) · 14.7 KB
/
Copy pathatom.xml
File metadata and controls
91 lines (76 loc) · 14.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>ZhySir Blog</title>
<subtitle>Android Developer</subtitle>
<link href="/atom.xml" rel="self"/>
<link href="https://zhysir.github.io/"/>
<updated>2018-12-25T05:01:35.501Z</updated>
<id>https://zhysir.github.io/</id>
<author>
<name>ZhySir</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>GITHUB HEXO博客搭建</title>
<link href="https://zhysir.github.io/2018/12/25/github-hexo-blog-build/"/>
<id>https://zhysir.github.io/2018/12/25/github-hexo-blog-build/</id>
<published>2018-12-25T04:11:22.000Z</published>
<updated>2018-12-25T05:07:43.388Z</updated>
<content type="html"><![CDATA[<h2 id="HEXO环境配置"><a href="#HEXO环境配置" class="headerlink" title="HEXO环境配置"></a>HEXO环境配置</h2><p>hexo非常容易安装。然而,在你开始之前需要一些东西。</p>
<h3 id="下载需要安装的程序"><a href="#下载需要安装的程序" class="headerlink" title="下载需要安装的程序"></a>下载需要安装的程序</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">http://nodejs.org/</div><div class="line">http://git-scm.com/</div></pre></td></tr></table></figure>
<p>或许我们还需要一个UTF-8编码的编辑器,因为Editplus编辑的文件都要用utf-8保存。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">http://www.cnblogs.com/hanzisearcher/archive/2012/09/14/editplus.html</div></pre></td></tr></table></figure>
<h3 id="安装HEXO"><a href="#安装HEXO" class="headerlink" title="安装HEXO"></a>安装HEXO</h3><p>桌面右击进入Git Bash:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g hexo</div></pre></td></tr></table></figure>
<p>hexo一旦安装,运行下面的命令Hexo将建立所有你需要的文件,在目标文件夹。<br><a id="more"></a></p>
<h3 id="新建HEXO博客"><a href="#新建HEXO博客" class="headerlink" title="新建HEXO博客"></a>新建HEXO博客</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">hexo init kaliwifi</div><div class="line"><span class="built_in">cd</span> kaliwifi</div><div class="line">npm install</div></pre></td></tr></table></figure>
<p>经过建设,这里就是项目文件夹看起来像这样子:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">.</div><div class="line">├── _config.yml</div><div class="line">├── package.json</div><div class="line">├── scaffolds</div><div class="line">├── scripts</div><div class="line">├── <span class="built_in">source</span></div><div class="line">| ├── _drafts</div><div class="line">| └── _posts</div><div class="line">└── themes</div></pre></td></tr></table></figure>
<h3 id="配置GITHUB"><a href="#配置GITHUB" class="headerlink" title="配置GITHUB"></a>配置GITHUB</h3><p>先到github网站注册帐号:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">https://github.com/</div></pre></td></tr></table></figure>
<h4 id="查看是否有SSH秘钥"><a href="#查看是否有SSH秘钥" class="headerlink" title="查看是否有SSH秘钥"></a>查看是否有SSH秘钥</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ls -al ~/.ssh</div></pre></td></tr></table></figure>
<h4 id="新建SSH-秘钥目录"><a href="#新建SSH-秘钥目录" class="headerlink" title="新建SSH 秘钥目录"></a>新建SSH 秘钥目录</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mkdir ~/.ssh</div></pre></td></tr></table></figure>
<h4 id="进入SSH秘钥目录"><a href="#进入SSH秘钥目录" class="headerlink" title="进入SSH秘钥目录"></a>进入SSH秘钥目录</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">cd</span> ~/.ssh</div></pre></td></tr></table></figure>
<h4 id="生成秘钥如果有多个GIT"><a href="#生成秘钥如果有多个GIT" class="headerlink" title="生成秘钥如果有多个GIT"></a>生成秘钥如果有多个GIT</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">ssh-keygen -t rsa -C <span class="string">"419905457@qq.com"</span> -f ~/.ssh/github</div><div class="line">ssh-keygen -t rsa -C <span class="string">"419905457@qq.com"</span> -f ~/.ssh/gitcafe</div></pre></td></tr></table></figure>
<p>这将在 ~/.ssh/ 目录下生成 github 和 github.pub 文件,记住千万不要把私钥文件 github 透露给任何人。</p>
<p>这将在 ~/.ssh/ 目录下生成 gitcafe 和 gitcafe.pub 文件,记住千万不要把私钥文件 gitcafe 透露给任何人。</p>
<h4 id="如果同时使用多个秘钥"><a href="#如果同时使用多个秘钥" class="headerlink" title="如果同时使用多个秘钥"></a>如果同时使用多个秘钥</h4><p>在 SSH 用户配置文件 ~/.ssh/config 中指定对应服务所使用的公秘钥名称</p>
<p>如果没有 config 文件的话就新建一个:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">touch ~/.ssh/config</div></pre></td></tr></table></figure>
<p>并输入以下内容,多个GIT可叠加:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">Host gitcafe.com www.gitcafe.com</div><div class="line">IdentityFile ~/.ssh/gitcafe</div><div class="line">Host github.com www.github.com</div><div class="line">IdentityFile ~/.ssh/github</div></pre></td></tr></table></figure></p>
<h4 id="添加-github-pub-中的内容到-Github-网站"><a href="#添加-github-pub-中的内容到-Github-网站" class="headerlink" title="添加 github.pub 中的内容到 Github 网站"></a>添加 github.pub 中的内容到 Github 网站</h4><p>settings<br>SSH keys<br>Add SSH Keys<br>在 Title 文本框中输入任意字符,<br>在 Key 文本框粘贴刚才复制的公钥字符串<br>按Add SSH按钮完成操作</p>
<h4 id="测试连接"><a href="#测试连接" class="headerlink" title="测试连接"></a>测试连接</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ssh -T git@github.com</div></pre></td></tr></table></figure>
<p>成功的话会出现:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">Hi vinyo! You<span class="string">'ve successfully authenticated, but GitHub does not provide shell a</span></div><div class="line"><span class="string">ccess.</span></div></pre></td></tr></table></figure>
<h4 id="github创建新项目"><a href="#github创建新项目" class="headerlink" title="github创建新项目"></a>github创建新项目</h4><p>点网站右上角加号New repository<br>Repository name项目名称为vinyo.github.io跟用户名相同后面官方后缀<br>例如:<br>vinyo.github.io<br>create repository创建</p>
<h4 id="GIT全局设置"><a href="#GIT全局设置" class="headerlink" title="GIT全局设置"></a>GIT全局设置</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">git config --global user.name <span class="string">'vinyo'</span></div><div class="line">git config --global user.email <span class="string">'419905457@qq.com'</span></div></pre></td></tr></table></figure>
<h4 id="域名配置"><a href="#域名配置" class="headerlink" title="域名配置"></a>域名配置</h4><p>source目录新建文件CNAME写上域名:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">zhysir.github.io</div></pre></td></tr></table></figure>
<p>将dnspod管理的域名解析到github博客域名:</p>
<p>第一种方法<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">@ CNAME vinyou.github.io</div><div class="line">www CNAME vinyou.github.io</div></pre></td></tr></table></figure></p>
<p>第二种方法<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">@ A 192.30.252.153</div><div class="line">WWW A 192.30.252.153</div></pre></td></tr></table></figure></p>
<p>备用IP或者ping博客vinyo.github.com得到的IP进行解析。<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">192.30.252.154</div></pre></td></tr></table></figure></p>
<p>dnspod支持域名解析均衡。</p>
<h4 id="配置-config-yml"><a href="#配置-config-yml" class="headerlink" title="配置_config.yml"></a>配置_config.yml</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">deploy: </div><div class="line"> <span class="built_in">type</span>: git</div><div class="line"> repository: git@github.com:vinyo/vinyo.github.io.git</div></pre></td></tr></table></figure>
<h4 id="生成静态"><a href="#生成静态" class="headerlink" title="生成静态"></a>生成静态</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo g</div></pre></td></tr></table></figure>
<p>如果出现错误执行以下清除文件命令或删除.deploy、public文件夹:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo clean</div></pre></td></tr></table></figure>
<h4 id="测试访问-http-localhost-4000"><a href="#测试访问-http-localhost-4000" class="headerlink" title="测试访问 http://localhost:4000/"></a>测试访问 <a href="http://localhost:4000/" target="_blank" rel="external">http://localhost:4000/</a></h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo s</div></pre></td></tr></table></figure>
<h4 id="上传到github"><a href="#上传到github" class="headerlink" title="上传到github"></a>上传到github</h4><p>安装扩展组件不然没上传到GITHUB的功能:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm install hexo-deployer-git --save</div><div class="line">hexo d</div></pre></td></tr></table></figure>
<h4 id="以下备用命令"><a href="#以下备用命令" class="headerlink" title="以下备用命令"></a>以下备用命令</h4><p>查找本文件夹所有文件所包含的文本内容:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">grep -nr fonts.googleapis.com ./</div></pre></td></tr></table></figure>
]]></content>
<summary type="html">
<h2 id="HEXO环境配置"><a href="#HEXO环境配置" class="headerlink" title="HEXO环境配置"></a>HEXO环境配置</h2><p>hexo非常容易安装。然而,在你开始之前需要一些东西。</p>
<h3 id="下载需要安装的程序"><a href="#下载需要安装的程序" class="headerlink" title="下载需要安装的程序"></a>下载需要安装的程序</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">http://nodejs.org/</div><div class="line">http://git-scm.com/</div></pre></td></tr></table></figure>
<p>或许我们还需要一个UTF-8编码的编辑器,因为Editplus编辑的文件都要用utf-8保存。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">http://www.cnblogs.com/hanzisearcher/archive/2012/09/14/editplus.html</div></pre></td></tr></table></figure>
<h3 id="安装HEXO"><a href="#安装HEXO" class="headerlink" title="安装HEXO"></a>安装HEXO</h3><p>桌面右击进入Git Bash:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g hexo</div></pre></td></tr></table></figure>
<p>hexo一旦安装,运行下面的命令Hexo将建立所有你需要的文件,在目标文件夹。<br>
</summary>
<category term="技术文章" scheme="https://zhysir.github.io/categories/technical-articles/"/>
<category term="GITHUB HEXO博客搭建" scheme="https://zhysir.github.io/tags/github-hexo-blog-build/"/>
</entry>
</feed>