$ sudo apt install git Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: git-man liberror-perl Suggested packages: git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn The following NEW packages will be installed: git git-man liberror-perl 0 upgraded, 3 newly installed, 0 to remove and 27 not upgraded. Need to get 4,738 kB of archives. After this operation, 33.9 MB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://mirrors.aliyun.com/ubuntu bionic/main amd64 liberror-perl all 0.17025-1 [22.8 kB] Get:2 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 git-man all 1:2.17.1-1ubuntu0.5 [803 kB] Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 git amd64 1:2.17.1-1ubuntu0.5 [3,912 kB] Fetched 4,738 kB in 7s (633 kB/s) Selecting previously unselected package liberror-perl. (Reading database ... 292089 files and directories currently installed.) Preparing to unpack .../liberror-perl_0.17025-1_all.deb ... Unpacking liberror-perl (0.17025-1) ... Selecting previously unselected package git-man. Preparing to unpack .../git-man_1%3a2.17.1-1ubuntu0.5_all.deb ... Unpacking git-man (1:2.17.1-1ubuntu0.5) ... Selecting previously unselected package git. Preparing to unpack .../git_1%3a2.17.1-1ubuntu0.5_amd64.deb ... Unpacking git (1:2.17.1-1ubuntu0.5) ... Setting up git-man (1:2.17.1-1ubuntu0.5) ... Setting up liberror-perl (0.17025-1) ... Setting up git (1:2.17.1-1ubuntu0.5) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
$ git config --global user.name "你的GitHub用户名" $ git config --global user.email "你的GitHub注册邮箱" $ ssh-keygen -t rsa -C "你的GitHub注册邮箱" Generating public/private rsa key pair. Enter file inwhich to save the key (/home/yoda/.ssh/id_rsa): Created directory '/home/yoda/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/yoda/.ssh/id_rsa. Your public key has been saved in /home/yoda/.ssh/id_rsa.pub.
$ ssh git@github.com Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts. PTY allocation request failed on channel 0 Hi hujiyi! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
安装 hexo
使用 yarn 命令安装Hexo,输入:
1 2 3 4 5 6 7 8 9 10 11
$ sudo yarn global add hexo-cli yarn global v1.21.1 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.1.2: The platform "linux" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "hexo-cli@3.1.0" with binaries: - hexo Done in 86.85s.
$ cd hujiyi.github.io/ ~/hujiyi.github.io$ hexo init INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git Cloning into '/home/yoda/hujiyi.github.io'... remote: Enumerating objects: 30, done. remote: Counting objects: 100% (30/30), done. remote: Compressing objects: 100% (24/24), done. remote: Total 161 (delta 12), reused 12 (delta 4), pack-reused 131 Receiving objects: 100% (161/161), 31.79 KiB | 174.00 KiB/s, done. Resolving deltas: 100% (74/74), done. Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-landscape.git) registered for path 'themes/landscape' Cloning into '/home/yoda/hujiyi.github.io/themes/landscape'... remote: Enumerating objects: 1054, done. remote: Total 1054 (delta 0), reused 0 (delta 0), pack-reused 1054 Receiving objects: 100% (1054/1054), 3.21 MiB | 107.00 KiB/s, done. Resolving deltas: 100% (581/581), done. Submodule path 'themes/landscape': checked out '73a23c51f8487cfcd7c6deec96ccc7543960d350' INFO Install dependencies yarn install v1.21.1 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.1.2: The platform "linux" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.11: The platform "linux" is incompatible with this module. info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 129.04s. INFO Start blogging with Hexo!
~/hujiyi.github.io$ yarn add hexo-wordcount yarn add v1.21.1 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.1.2: The platform "linux" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.11: The platform "linux" is incompatible with this module. info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 1 new dependency. info Direct dependencies └─ hexo-wordcount@6.0.1 info All dependencies └─ hexo-wordcount@6.0.1 Done in 9.20s.
~/hujiyi.github.io$ yarn add hexo-generator-json-content yarn add v1.21.1 [1/4] Resolving packages... [2/4] Fetching packages... warning Pattern ["hexo-util@latest"] is trying to unpack in the same destination "/home/yoda/.cache/yarn/v6/npm-hexo-util-1.8.1-d8287561709e246a6a73f07fccaed2a82865a736-integrity/node_modules/hexo-util" as pattern ["hexo-util@^1.8.0","hexo-util@^1.4.0","hexo-util@^1.0.0"]. This could result in non-deterministic behavior, skipping. warning Pattern ["moment@latest"] is trying to unpack in the same destination "/home/yoda/.cache/yarn/v6/npm-moment-2.24.0-0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b-integrity/node_modules/moment" as pattern ["moment@^2.22.2","moment@>= 2.9.0","moment@^2.10.6","moment@^2.18.0"]. This could result in non-deterministic behavior, skipping. info fsevents@2.1.2: The platform "linux" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.11: The platform "linux" is incompatible with this module. info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 4 new dependencies. info Direct dependencies └─ hexo-generator-json-content@4.1.6 info All dependencies ├─ hexo-generator-json-content@4.1.6 ├─ keyword-extractor@0.0.18 ├─ underscore.string@3.3.5 └─ underscore@1.9.1 Done in 2.13s.
配置:
在博客配置文件_config.yml中添加
1 2 3 4 5 6 7
jsonContent: ignore: -path/to/a/page -url/to/one/post -an-entire-category -specific.file -.ext# a file extension
~/hujiyi.github.io$ yarn add hexo-neat yarn add v1.21.1 [1/4] Resolving packages... [2/4] Fetching packages... warning Pattern ["hexo-util@latest"] is trying to unpack in the same destination "/home/yoda/.cache/yarn/v6/npm-hexo-util-1.8.1-d8287561709e246a6a73f07fccaed2a82865a736-integrity/node_modules/hexo-util" as pattern ["hexo-util@^1.8.0","hexo-util@^1.4.0","hexo-util@^1.0.0"]. This could result in non-deterministic behavior, skipping. warning Pattern ["moment@latest"] is trying to unpack in the same destination "/home/yoda/.cache/yarn/v6/npm-moment-2.24.0-0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b-integrity/node_modules/moment" as pattern ["moment@^2.22.2","moment@>= 2.9.0","moment@^2.10.6","moment@^2.18.0"]. This could result in non-deterministic behavior, skipping. info fsevents@2.1.2: The platform "linux" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.11: The platform "linux" is incompatible with this module. info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 25 new dependencies. info Direct dependencies └─ hexo-neat@1.0.4 info All dependencies ├─ any-promise@1.3.0 ├─ change-case@3.0.2 ├─ clean-css@4.2.3 ├─ commander@2.9.0 ├─ constant-case@2.0.0 ├─ dot-case@2.1.1 ├─ he@1.1.1 ├─ header-case@1.0.1 ├─ hexo-neat@1.0.4 ├─ html-minifier@2.1.7 ├─ is-lower-case@1.1.3 ├─ is-upper-case@1.1.2 ├─ lower-case-first@1.0.2 ├─ ncname@1.0.0 ├─ object-assign@4.1.1 ├─ param-case@2.1.1 ├─ path-case@2.1.1 ├─ relateurl@0.2.7 ├─ sentence-case@2.1.1 ├─ stream-to-array@2.3.0 ├─ swap-case@1.1.2 ├─ title-case@2.1.1 ├─ uglify-js@2.6.4 ├─ upper-case-first@1.1.2 └─ xml-char-classes@1.0.0 Done in 4.09s.
~/hujiyi.github.io$ yarn add hexo-deployer-git yarn add v1.21.1 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.1.2: The platform "linux" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.11: The platform "linux" is incompatible with this module. info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 1 new dependency. info Direct dependencies └─ hexo-deployer-git@2.1.0 info All dependencies └─ hexo-deployer-git@2.1.0 Done in 7.44s.