{"id":36,"date":"2021-01-11T19:41:58","date_gmt":"2021-01-11T11:41:58","guid":{"rendered":"http:\/\/mengstudy.com\/?p=36"},"modified":"2021-01-11T19:41:58","modified_gmt":"2021-01-11T11:41:58","slug":"hexogithub%e6%90%ad%e5%bb%ba%e5%8d%9a%e5%ae%a2%e5%b9%b3%e5%8f%b0","status":"publish","type":"post","link":"https:\/\/fugary.com\/?p=36","title":{"rendered":"Hexo+GitHub\u642d\u5efa\u535a\u5ba2\u5e73\u53f0"},"content":{"rendered":"<p>Hexo\u9700\u8981\u4f7f\u7528Git\u548cNodejs\uff0c\u56e0\u6b64\u9700\u8981\u63d0\u524d\u5b89\u88c5\u597dGit\u548cNodejs<\/p>\n<p>\u8be6\u7ec6\u6587\u6863\uff08\u8fd9\u7f51\u7ad9\u4e0d\u662f\u5f88\u7a33\u5b9a\uff09\uff1ahttps:\/\/hexo.io\/zh-cn\/docs\/index.html<\/p>\n<h3>Hexo\u535a\u5ba2\u5e73\u53f0\u539f\u7406<\/h3>\n<p>Hexo\u4f7f\u7528Markdown\u89e3\u6790\u5668\u628aMarkdown\u6587\u4ef6\u914d\u5408\u4e3b\u9898\u751f\u6210\u9759\u6001\u7f51\u9875\uff0c\u5e76\u4e14\u652f\u6301\u53d1\u5e03\u5230GitHub Pages\uff0c\u65b9\u4fbf\u4e2a\u4eba\u751f\u6210\u535a\u5ba2\u7f51\u7ad9\u3002\u672c\u8d28\u4e0a\u751f\u6210\u4e86\u9759\u6001\u7684html\u4e4b\u540e\u53ef\u4ee5\u53d1\u5e03\u5230\u4efb\u4f55web\u670d\u52a1\u5668\u5e73\u53f0\u3002<\/p>\n<p>\u4f46\u662f\u53ea\u662f\u4e00\u4e2a\u9759\u6001\u7684\u7f51\u7ad9\uff0c\u6ca1\u6709\u81ea\u5df1\u7684\u6570\u636e\u5e93\uff0c\u4e0d\u652f\u6301\u540e\u53f0\u7ba1\u7406\u7b49\u52a8\u6001\u7ba1\u7406\u529f\u80fd\u3002<\/p>\n<p>\u53e6\u5916\u8981\u652f\u6301\u8bc4\u8bba\u7684\u8bdd\u9700\u8981\u4f7f\u7528\u7b2c\u4e09\u65b9\u7684\u6570\u636e\u5e93\uff0c\u53ef\u7528Valine\u5de5\u5177\uff0c\u6570\u636e\u5b58\u50a8\u5230LeanCloud\uff0c\u6216\u8005gitalk\u3002<\/p>\n<h3>\u5b89\u88c5Hexo<\/h3>\n<p>\u6839\u636e\u81ea\u5df1\u7684\u5e73\u53f0\u9009\u62e9\u6700\u65b0\u7248\u7684\u5b89\u88c5\uff1a<\/p>\n<p>Nodejs\u5b89\u88c5\uff1ahttp:\/\/nodejs.cn\/download\/<\/p>\n<p>Git\u5b89\u88c5\uff1ahttps:\/\/git-scm.com\/downloads<\/p>\n<p>\u5982\u679c\u8bbf\u95ee\u5931\u8d25\u53ef\u4ee5\u8bd5\u8bd5\u6dd8\u5b9d\u7684\u955c\u50cf\uff1ahttps:\/\/npm.taobao.org\/mirrors\/git-for-windows\/<\/p>\n<p>\u5b89\u88c5\u5b8c\u57fa\u672c\u7684\u5de5\u5177\u4e4b\u540e\uff0c\u5148\u770b\u770b\u73af\u5883\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ npm -v\n6.14.3\n\n$ git --version\ngit version 2.26.0.windows.1\n<\/code><\/pre>\n<p>\u4f7f\u7528 npm \u5b89\u88c5 Hexo\uff0c\u5168\u5c40\u5b89\u88c5hexo-cli\uff0c\u65b9\u4fbf\u4f7f\u7528\uff0c\u53ef\u4ee5\u4f7f\u7528\u56fd\u5185\u7684registry\u52a0\u901f\u3002<\/p>\n<p>\u53c2\u8003\u5730\u5740\uff1ahttps:\/\/cnpmjs.org\/<\/p>\n<p>\u53ef\u4ee5\u624b\u52a8\u6dfb\u52a0--registry\u6216\u8005\u8bbe\u7f6eregistry<\/p>\n<pre><code class=\"language-bash line-numbers\">npm config set registry https:\/\/r.cnpmjs.org\n<\/code><\/pre>\n<pre><code class=\"language-shell line-numbers\">$ npm install -g hexo-cli --registry=https:\/\/r.cnpmjs.org\nC:\\Users\\gary.fu\\AppData\\Roaming\\npm\\hexo -&gt; C:\\Users\\gary.fu\\AppData\\Roaming\\npm\\node_modules\\hexo-cli\\bin\\hexo\nnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\\hexo-cli\\node_modules\\fsevents):\nnpm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {\"os\":\"darwin\",\"arch\":\"any\"} (current: {\"os\":\"win32\",\"arch\":\"x64\"})\n\n+ hexo-cli@3.1.0\nadded 81 packages from 322 contributors in 25.679s\n<\/code><\/pre>\n<p>\u5b89\u88c5\u540e\u6d4b\u8bd5\u663e\u793a<code>hexo -v<\/code>\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">hexo -v\nhexo: 4.2.0\nhexo-cli: 3.1.0\nos: Windows_NT 6.1.7601 win32 x64\nnode: 12.10.0\nv8: 7.6.303.29-node.16\nuv: 1.31.0\nzlib: 1.2.11\nbrotli: 1.0.7\nares: 1.15.0\nmodules: 72\nnghttp2: 1.39.2\nnapi: 4\nllhttp: 1.1.4\nhttp_parser: 2.8.0\nopenssl: 1.1.1c\ncldr: 35.1\nicu: 64.2\ntz: 2019a\nunicode: 12.1\n<\/code><\/pre>\n<h3>\u65b0\u5efa\u535a\u5ba2\u5e73\u53f0<\/h3>\n<p>\u521d\u59cb\u5316hexo\u9879\u76ee\u547d\u4ee4\u5982\u4e0b<code>hexo init xxxx<\/code>\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">$ hexo init MengStudyBlog\nINFO  Cloning hexo-starter https:\/\/github.com\/hexojs\/hexo-starter.git\nCloning into 'C:\\MyCodes\\CustomCode\\MengStudyBlog'...\nremote: Enumerating objects: 30, done.\nremote: Counting objects: 100% (30\/30), done.\nremote: Compressing objects: 100% (24\/24), done.\nremote: Total 161 (delta 12), reused 12 (delta 4), pack-reused 131\nReceiving objects: 100% (161\/161), 31.79 KiB | 75.00 KiB\/s, done.\nResolving deltas: 100% (74\/74), done.\nSubmodule 'themes\/landscape' (https:\/\/github.com\/hexojs\/hexo-theme-landscape.git) registered for path 'themes\/landscape'\nCloning into 'C:\/MyCodes\/CustomCode\/MengStudyBlog\/themes\/landscape'...\nremote: Enumerating objects: 1063, done.\nremote: Total 1063 (delta 0), reused 0 (delta 0), pack-reused 1063\nReceiving objects: 100% (1063\/1063), 3.21 MiB | 232.00 KiB\/s, done.\nResolving deltas: 100% (585\/585), done.\nSubmodule path 'themes\/landscape': checked out '73a23c51f8487cfcd7c6deec96ccc7543960d350'\nINFO  Install dependencies\n\n&gt; ejs@2.7.4 postinstall C:\\MyCodes\\CustomCode\\MengStudyBlog\\node_modules\\ejs\n&gt; node .\/postinstall.js\n\nThank you for installing EJS: built with the Jake JavaScript build tool (https:\/\/jakejs.com\/)\n\nnpm notice created a lockfile as package-lock.json. You should commit this file.\nnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\\chokidar\\node_modules\\fsevents):\nnpm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {\"os\":\"darwin\",\"arch\":\"any\"} (current: {\"os\":\"win32\",\"arch\":\"x64\"})\n\nadded 253 packages from 450 contributors and audited 470 packages in 49.115s\n\n5 packages are looking for funding\n  run `npm fund` for details\n\nfound 1 low severity vulnerability\n  run `npm audit fix` to fix them, or `npm audit` for details\nINFO  Start blogging with Hexo!\n<\/code><\/pre>\n<p>\u8fdb\u5165\u8be5\u76ee\u5f55\uff0c\u5b89\u88c5\u672c\u5730\u4f9d\u8d56\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">cd MengStudyBlog\nnpm install\n<\/code><\/pre>\n<p>\u5176\u5b9e\u8fd9\u4e2a\u65f6\u5019\u9ed8\u8ba4\u7f51\u7ad9\u5df2\u7ecf\u6210\u578b\u4e86\uff0c\u53ef\u4ee5\u8fd0\u884c\u770b\u770b\u6548\u679c\uff0c\u540e\u9762\u518d\u6539\u914d\u7f6e\uff0c\u5b9e\u73b0\u81ea\u5df1\u81ea\u5b9a\u4e49\u7684\u7f51\u7ad9\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">hexo server\n<\/code><\/pre>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee\uff1ahttp:\/\/localhost:4000\/<\/p>\n<h3>\u914d\u7f6e\u535a\u5ba2\u5e73\u53f0<\/h3>\n<p>\u53c2\u8003\u5730\u5740: https:\/\/hexo.io\/zh-cn\/docs\/configuration<\/p>\n<h4>\u914d\u7f6e\u57fa\u672c\u4fe1\u606f<\/h4>\n<p>\u914d\u7f6e\u6587\u4ef6<code>_config.yml<\/code>\uff0c\u914d\u7f6e\u597d\u81ea\u5df1\u7684\u535a\u5ba2\u540d\u79f0\u7b49\uff1a<\/p>\n<pre><code class=\"language-yaml line-numbers\">title: \u68a6\u5b66\u56ed\u535a\u5ba2\nsubtitle: 'Gary\u7684\u4e2a\u4eba\u535a\u5ba2\u7f51\u7ad9'\ndescription: '\u6280\u672f\u535a\u5ba2\uff0c\u5173\u6ce8\u8f6f\u4ef6\u5f00\u53d1\u3001\u5fae\u670d\u52a1\u3001\u5206\u5e03\u5f0f'\nkeywords:\nauthor: Gary Fu\nlanguage: cn\ntimezone: 'Asia\/Shanghai'\n<\/code><\/pre>\n<h4>\u914d\u7f6e\u4e3b\u9898<\/h4>\n<p>\u4e3b\u9898\u914d\u7f6e\u6587\u6863\uff1ahttps:\/\/hexo.io\/zh-cn\/docs\/themes<\/p>\n<p>\u4e3b\u9898\u9009\u62e9\uff1ahttps:\/\/hexo.io\/themes\uff0c\u91cc\u9762\u6709\u5f88\u591a\u4e3b\u9898\uff0c\u9009\u62e9\u81ea\u5df1\u559c\u6b22\u7684\u4e3b\u9898\u4e4b\u540e\u4e0b\u8f7d\u6e90\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n<p>\u4e3b\u9898\u662f\u5728\u751f\u6210\u7684\u6587\u4ef6\u5939\u4e0b\u9762\u6709\u4e2a<code>themes<\/code>\u76ee\u5f55\uff0c\u4e0b\u9762\u5df2\u7ecf\u6709\u4e00\u4e2a\u9ed8\u8ba4\u4e3b\u9898\u4e86\uff0c\u540d\u53eb<code>landscape<\/code>\uff0c\u5728<code>_config.yml<\/code>\u4e2d\u914d\u7f6e\u6709\u9ed8\u8ba4\u7684\u4e3b\u9898\u540d\u5b57\u3002<\/p>\n<pre><code class=\"language-yaml line-numbers\">theme: landscape\n<\/code><\/pre>\n<p>\u4e0b\u8f7d\u4e3b\u9898\uff0c\u6211\u9009\u62e9<code>pure<\/code>\u4e3b\u9898\u8bd5\u7528https:\/\/github.com\/cofess\/hexo-theme-pure\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">git clone https:\/\/github.com\/cofess\/hexo-theme-pure.git themes\/pure\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u4f7f\u7528\u5b8c\u6574\u529f\u80fd\uff0c\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u63d2\u4ef6\uff08\u6587\u6863\u4e2d\u6709\u8bf4\u660e\uff09\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">npm install hexo-wordcount --save\nnpm install hexo-generator-json-content --save\nnpm install hexo-generator-feed --save\nnpm install hexo-generator-sitemap --save\nnpm install hexo-generator-baidu-sitemap --save\n<\/code><\/pre>\n<h3>\u53d1\u5e03\u5230GitHub<\/h3>\n<ol>\n<li>\u9996\u5148\u8981\u65b0\u5efa\u4e00\u4e2a\u4ed3\u5e93\uff0c\u540d\u79f0\u4e3aGitHub\u8d26\u53f7\u540d\u79f0\u52a0github.io\u7ed3\u5c3e\uff0c\u5982\u6211\u81ea\u5df1\u7684\uff1afugary.github.io<\/li>\n<\/ol>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='C:%5CUsers%5Cgary.fu%5CDesktop%5Cpicgo%5Chexo%5C1.png'><img src=\"C:%5CUsers%5Cgary.fu%5CDesktop%5Cpicgo%5Chexo%5C1.png\" alt=\"\" \/><\/div><\/p>\n<ol start=\"2\">\n<li>\u5b89\u88c5\u53d1\u5e03git\u7684\u63d2\u4ef6\n<pre><code class=\"language-bash line-numbers\">npm install hexo-deployer-git --save\n<\/code><\/pre>\n<\/li>\n<li>\u7136\u540e\u914d\u7f6e<code>_config.yml<\/code>\uff0c\u6dfb\u52a0deploy\u914d\u7f6e\uff1a<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"language-yml line-numbers\">deploy:\n  type: git\n  repo: https:\/\/github.com\/fugary\/fugary.github.io.git\n  branch: master\n<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>\u8c03\u7528\u53d1\u5e03\u547d\u4ee4<\/p>\n<pre><code class=\"language-bash line-numbers\">hexo g\nhexo d\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<pre><code class=\"line-numbers\">\u5982\u679c\u6ca1\u6709\u914d\u7f6e\u514d\u5bc6\u7801\u767b\u5f55\uff0c\u9700\u8981\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\n\n   ```bash\n   Username for 'https:\/\/github.com': xxxx\n   Password for 'https:\/\/xxxx@github.com':\n<\/code><\/pre>\n<h3>\u7ed1\u5b9a\u4e2a\u4eba\u57df\u540d<\/h3>\n<p>\u8981\u914d\u7f6e\u4e2a\u4eba\u57df\u540d\uff0c\u4e3b\u8981\u6709\u4e24\u4e2a\u90e8\u5206\u8981\u914d\u7f6e\uff0c\u4e00\u90e8\u5206\u662f\u914d\u7f6e\u57df\u540d\u89e3\u6790\uff0c\u5df2\u4e0d\u662f\u662f\u6e90\u6587\u4ef6\u4e2d\u9700\u8981\u914d\u7f6e\u4e00\u4e2aCNAME\u6587\u4ef6<\/p>\n<h4>\u914d\u7f6e\u57df\u540d\u89e3\u6790<\/h4>\n<p>\u8981\u7ed1\u5b9a\u4e2a\u4eba\u57df\u540d\uff0c\u9700\u8981\u5148\u7533\u8bf7\u4e00\u4e2a\u57df\u540d\uff0c\u6211\u76ee\u524d\u4f7f\u7528\u7684\u662f\u963f\u91cc\u4e91\u7684\u57df\u540d\uff1a<\/p>\n<p><strong>\u6ce8\u610f\uff1a\u57df\u540d\u72b6\u6001\u5982\u679c\u662f\u672a\u5b9e\u540d\u8ba4\u8bc1\uff0c\u914d\u7f6e\u540e\u4e5f\u662f\u4e0d\u80fd\u6b63\u5e38\u8bbf\u95ee\u7684\u3002\u5fc5\u987b\u5148\u5b9e\u540d\u8ba4\u8bc1<\/strong><\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20200410095147.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20200410095147.png\" alt=\"\" \/><\/div><\/p>\n<p>\u914d\u7f6e\u89e3\u6790CNAME\uff1a<\/p>\n<p>\u7406\u8bba\u4e0a\u4e5f\u662f\u53ef\u4ee5\u914d\u7f6eA\u8bb0\u5f55\u7684\uff0c\u914d\u7f6eIP\u5730\u5740\uff0c\u4f46\u662f\u6211\u4eec\u7684github\u7f51\u7ad9\u7684IP\u5730\u5740\u5e76\u4e0d\u56fa\u5b9a\uff0c\u591a\u6b21ping\u7684\u65f6\u5019\u4f1a\u5f97\u5230\u591a\u4e2aIP\u5730\u5740\uff0c\u56e0\u6b64\u8fd8\u662f\u5148\u7528CNAME\u65b9\u5f0f\u914d\u7f6e\u3002<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20200410095215.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20200410095215.png\" alt=\"\" \/><\/div><\/p>\n<p>\u7136\u540e\u8981\u7b49\u5f8510\u5206\u949f\u5de6\u53f3\u624d\u80fd\u751f\u6548\u3002<\/p>\n<h4>\u7ed9Hexo\u6dfb\u52a0CNAME<\/h4>\n<p>\u9700\u8981\u5728\u6211\u4eec\u7684\u5de5\u7a0b\u76ee\u5f55\u4e0b\u7684source\u6587\u4ef6\u5939\u4e2d\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3aCNAME\u7684\u6587\u4ef6\uff08\u65e0\u6269\u5c55\u540d\uff09\uff0c\u7136\u540e\u628a\u81ea\u5df1\u7684\u57df\u540d\u586b\u8fdb\u53bb\u3002<\/p>\n<p>\u7136\u540e\u91cd\u65b0\u751f\u6210\u5e76\u53d1\u5e03:<\/p>\n<pre><code class=\"language-bash line-numbers\">hexo clean\nhexo g\nhexo d\n<\/code><\/pre>\n<h4>\u8bbf\u95ee\u6d4b\u8bd5<\/h4>\n<p>\u7b49\u5f85\u57df\u540d\u89e3\u6790\u751f\u6548\u4e4b\u540e\u5c31\u53ef\u4ee5\u6d4b\u8bd5\u8bbf\u95ee\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hexo\u9700\u8981\u4f7f\u7528Git\u548cNodejs\uff0c\u56e0\u6b64\u9700\u8981\u63d0\u524d\u5b89\u88c5\u597dGit\u548cNodejs \u8be6\u7ec6\u6587\u6863\uff08\u8fd9\u7f51\u7ad9\u4e0d\u662f\u5f88\u7a33\u5b9a\uff09\uff1ah [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/36"}],"collection":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":1,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}