Mac 安装博客 Hexo

安装 Git

参考:Mac 安装 Git

配置 Git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 1、配置 Git(输入你的 GitHub 用户名 和 邮箱)
----------------git config --global user.name "TaoPanfeng"
----------------git config --global user.email "1801957499@qq.com"
# 2、生成公钥(填写你的 GitHub 邮箱)
----------------ssh-keygen -t rsa -C "1801957499@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/PTAO/.ssh/id_rsa): # 直接回车
Enter passphrase (empty for no passphrase): # 直接回车
Enter same passphrase again: # 直接回车
Your identification has been saved in /Users/PTAO/.ssh/id_rsa.
Your public key has been saved in /Users/PTAO/.ssh/id_rsa.pub. # 路径下面要用
The key fingerprint is:
SHA256:Xv1jmO ...
+----[SHA256]-----+
# 3、查看公钥,全部复制(后面要用)
----------------cat /Users/PTAO/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2E ...
----------------

4)、打开 GitHub keys 设置
》》》添加 SSH key,起个名称,把上面的 pub key 全部复制进去。
在这里插入图片描述

1
2
3
4
5
6
7
8
9
# 5、测试连接
----------------ssh git@github.com
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes # 输入 yes
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi TaoPanfeng! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

安装 Node.js

2021-01-27 17:42:12

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 1、安装 Node.js
----------------brew install node
Updating Homebrew...

... ...

==> node
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
# 2、查看 Node.js 版本
----------------node -v
v15.7.0
# 3、查看 npm(Node Package Manager)版本
----------------npm -v
7.4.3
----------------

安装 Hexo

1)、安装:npm -g install hexo-cli

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
# 1、安装
----------------npm -g install hexo-cli

added 66 packages, and audited 67 packages in 10s

11 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities
# 2、查看版本
----------------hexo version
hexo-cli: 4.2.0
os: Darwin 20.2.0 darwin x64
node: 15.7.0
v8: 8.6.395.17-node.23
uv: 1.40.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.17.1
modules: 88
nghttp2: 1.42.0
napi: 7
llhttp: 2.1.3
openssl: 1.1.1i
cldr: 37.0
icu: 67.1
tz: 2019c
unicode: 13.0

搭建新博客

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 1、初始化博客,会在当前目录创建 blog 文件夹
----------------hexo init blog
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
INFO Start blogging with Hexo!
----------------cd blog
# 2、查看内容
----------------ls
_config.landscape.yml node_modules package.json source
_config.yml package-lock.json scaffolds themes
# 3、本地启动
----------------hexo s
# hexo主题next访问报错{% extends ‘_layout.swig‘ %} {% import ‘_macro/post.swig‘ as post_template %}
# hexo在5.0之后把swig给删除了需要自己手动安装
# npm i hexo-renderer-swig
INFO Validating config
INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

在这里插入图片描述

安装 SVN

2021-01-27 18:22:17

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 1、安装 SVN
----------------brew install subversion
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/apr-1.7.0_2.big_sur.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/d9a9554a726ec60e124055a55747e6e7f4cff6310955d6340be

... ...

Bash completion has been installed to:
/usr/local/etc/bash_completion.d
# 2、查看 SVN 版本
----------------svn --version
svn,版本 1.14.0 (r1876290)
编译于 Jan 6 2021,17:23:37 在 x86_64-apple-darwin20.2.0

... ...

* Mac OS X Keychain

SVN 检出指定目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 检出指定目录(想检出什么目录,在后面追加目录名即可)
# 检出的目录会放在当前目录
----------------svn checkout https://svn.coding.net/taopanfeng/svn_coding_blog/svn_coding_blog/blog
认证领域: <https://svn.coding.net:443> Coding
“PTAO”的密码: ****** # 输入 Mac PTAO 账号的密码

认证领域: <https://svn.coding.net:443> Coding
用户名: 1801957499@qq.com # 输入邮箱
“1801957499@qq.com”的密码: *********** # 输入密码

A blog/source
A blog/source/_posts
A blog/source/_posts/2019-04-25...00.00.11.md
A blog/source/_posts/2021-01-08...15.40.17.md
A blog/source/_posts/2020-04-17...17.31.51.md
... ...

在这里插入图片描述

博客同步到 Gitee

1)、创建仓库(事后我才发现,竟然写成了 blob,应该是 blog 的呀~!!!就先暂时这样吧。)
在这里插入图片描述
2)、IDEA 导入
在这里插入图片描述
3)、本地目录,准备上传到 gitee 仓库
在这里插入图片描述

4)、导入(gitee => IDEA)

在这里插入图片描述
在这里插入图片描述
5)、把所有东西移动到 IDEA 项目中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
----------------pwd
/Users/PTAO/blog_test/blog
----------------ll
total 40
-rw-r--r-- 1 PTAO 1000 1156 1 27 19:03 Question.md
-rw-r--r-- 1 PTAO 1000 2813 1 27 19:03 Question_No_Record.md
-rw-r--r-- 1 PTAO 1000 3410 1 27 19:03 _config.yml
-rw-r--r-- 1 PTAO 1000 761 1 27 19:03 package.json
drwxr-xr-x 5 PTAO 1000 160 1 27 19:03 scaffolds
drwxr-xr-x 8 PTAO 1000 256 1 27 19:03 source
drwxr-xr-x 11 PTAO 1000 352 1 27 19:03 source_bak
drwxr-xr-x 3 PTAO 1000 96 1 27 19:03 themes
-rw-r--r-- 1 PTAO 1000 2864 1 27 19:03 修改记录.md
----------------
----------------
----------------
----------------mv * /Users/PTAO/IdeaProjects/blob/