Hexxo World

关于 - ABOUT: 之前是用jekyll(杰克尔)写我的文章的, 个人觉得太不好用(1.社区资料不多(包括: 搜了一通’jekyll 文章分类’, 一整个搜索结果页没有能帮得上的结果), 2.风格不够简约, 3.官网主页不给力(弄了一个晚上还没法把博客的风格简单改一改), 4.等等), 懊恼之中, 忽然想到为什么不用一用hexo(后来发现我还挺适应hexo的, 难道是因为它使用了node.js后端(而我具有好感)?!). (此处, 收录一个过程中搜索到的Markdown总结, 其文末的一些索引, 个人觉得有用, 这也一定是作者挑选过才会放上去的, 还有Jlcao博客的归档)

博客还在设置和进化中, 希望我的’Computer Fake Science’能够在它的伴随下’皆为序章’起来.

在创建博客的过程中, 参考了一些文章, Mark在此: 0.本篇的主要参考, 1.Hexo中文文档, 2.Next主题的读我, 3.Jekyll Or Hexo, 4.Hexo&Jekyll, 5.Hexo史上最全, 以及其它一些需要Mark的站点(内容, 风格等): 1.Jiaxi, 2.ixirong, 3.saili, 4.11TT, 5.dandyxu, 6.simon, 7.iissnan, 8.fangzh, 9.BlogsHere主题, 10.首页隐藏部分文章.

附: 安装中的插曲(Error: ACCES: permission denied错误解决)

由于不具名的原因, 本地安装此Hexo环境(就像平常安装环境)时, 报错:

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
MBPTB-USR:desktop univesre$ npm install -g hexo-cli
npm WARN deprecated mixin-deep@1.3.1: Critical bug fixed in v2.0.1, please upgrade to the latest version.
npm WARN deprecated set-value@2.0.0: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm WARN deprecated set-value@0.4.3: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/univesre/.npm/_logs/2019-06-20T15_33_33_692Z-debug.log

看到Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\', 总以为是npm install命令对于node_modules文件的权限不够(然后就sudo咯), 而在npmjs.com中, 有这个问题的解决办法(原因和install packages globally有关). 在此, 梳理下这个安装问题的解决步骤:

  1. 执行命令npm install -g hexo-cli, 出现Error: EACCES: ..问题;

    • 搜解决办法(百度搜’npm permission denied’), 搜到一个用sudo解决的, 然后sudo npm install -g hexo-cli, 还是一样的错误;
  2. 搜博文一篇(就是它了), 其中说nvm官方教程中为了预防此类权限错误而给的一篇文档, 参照文档内解决链接Downloading and installing Node.js and npm;

  3. 照着文档, Using a Node version manager to install Node.js and npm, 先安装nvm命令(curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash), 一切顺利, 安装末了, 有提示:

    1
    2
    3
    4
    5
    6
    => ...
    => Close and reopen your terminal to start using nvm or run the following to use it now:

    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

    (根据终端的提示, 继续执行上述三行提示的操作, 直到完成)

  4. 接着, 安装nvm命令完成后, 再nvm install node(此步, 顺利结束);

  5. 接着, npm install -g hexo-cli, 等待完成(此步, hexo终端命令已安装完成);

  6. 接着, hexo init github_hexo, 初始化此Hexo博客的本地文件夹, 最后有如下提示:

    1
    2
    ...
    INFO Start blogging with Hexo!
  1. 此刻, Hexo博客环境算安装好了, 可以cd github_hexo进入博客文件夹, 进行blogging了.



关于Github修改密码之后, 本地ssh上的更新

背景: 在Github上修改了账户密码, 导致本地hexo d部署博文时出错(密码改了导致本地id_rsa.pub文件中的密码串无法与新更改的密码对上), 于是, 这个ssh与Github绑定的流程要重新来一遍了: (操作系统: Mac OSX)

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
$ cd ~/.ssh/
$ ls
id_rsa id_rsa.pub # 这两个是原先的密码文件;
# 步骤1/2: 生成ssh的通信'密码字串', 将会登记到Github网站上;
$ ssh-keygen -t rsa -C "your_email@example.com" # 这里的邮箱地址是Github的登录账号用的邮箱;
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username_xxx/.ssh/id_rsa): # 默认的话直接回车即可;
Enter passphrase (empty for no passphrase): # 输入一下密码(文件密码?!), 或者直接回车不设密码;
Enter same passphrase again: # 再次确认输入;
Your identification has been saved in /Users/username_xxx/.ssh/id_rsa. # 成功;
Your public key has been saved in /Users/username_xxx/.ssh/id_rsa.pub. # 成功;
The key fingerprint is:
SHA256:uD+ZClxZRxMYJPxxxx4FZRJsdDGFOxxERabxxjOyIoU your_email@example.com # 结果(这里修改过);
The key's randomart image is: # 结果(这里修改过);
+---[RSA 2048]----+
| oxxX+. |
| xxx. |
| .=o*. |
| x xxx . |
|X x xxx S |
| = + * * |
|o xxxB o x |
|xx = .+ |
| . xxx x |
+----[SHA256]-----+
# 步骤2/2: 查看'密码字串', 这个字串(包括最后的email)要登记到Github网站上;
$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2..省略若干字串..fnP6lqh4uMxn/LyGrI6ZtFxXk...省略若干字串...HHROkVwyO16rXfUZq++siDwoU/nx your_email@example.com # 密码字串结束;
$ ssh -T git@github.com # 测试看是否成功: 成功;
Enter passphrase for key '/Users/username_xxx/.ssh/id_rsa':
Hi githuber! You've successfully authenticated, but GitHub does not provide shell access.

以上生成密码字串的过程, 主要是步骤1/2步骤2/2, 然后剩下的是: 登录到Github网站上, 将步骤2中的那一串字串更新到Github后台. (如下图)

修改密码_图01_完成.jpeg

下次, 如果Github的密码再次修改掉了, 这个密码字串也就失效了(这其中的机制估计是: Github在密码使用期内对密码字串是保持通信认可的(因为ssh也使用这个密码字串), 而修改了Github密码后, Github认为所有之前登记的密码字串都失效了, 故, 需要在修改密码后添加进新的密码字串(即, ssh通信中使用的那个最新字串)).

Ref: [博文]


Original “Hello World” Post

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

1. Create a new post / More info: Writing / $ hexo new "My New Post"

2. Run server / More info: Server / $ hexo server

3. Generate static files / More info: Generating / $ hexo generate

4. Deploy to remote sites / More info: Deployment / $ hexo deploy