0%

1
2
template<typename Key, typename Value>
struct Node {};

为例,试创建有n个Node类型的node的数组。

方法一(nodes[i]为指针):

1
2
3
struct Node<int, int> *nodes[n];
for (size_t i = 0; i < n; i++)
nodes[i] = (struct Node<int, int>*)malloc(sizeof(struct Node<int, int>) * n);

使用

1
2
3
for (size_t i = 0; i < n; i++) {
std::free(nodes[i]);
}

释放nodes的内存。

方法二(nodes[i]为指针):

1
2
3
struct Node<int, int> **nodes = (struct Node<int, int>**)malloc(sizeof(struct Node<int, int>*) * n);
for (size_t i = 0; i < n; i++)
nodes[i] = (struct Node<int, int>*)malloc(sizeof(struct Node<int, int>));

使用

1
2
3
4
for (size_t i = 0; i < n; i++) {
std::free(nodes[i]);
}
std::free(nodes);

释放nodes的内存。

方法三(nodes[i]为结构体struct):

1
struct Node<int, int> *nodes = (struct Node<int, int>*)std::malloc(sizeof(struct Node<int, int>) * n);

使用

1
std::free(nodes);

释放nodes的内存。如果将nodes插入到类中,注意应考虑类的析构函数。

错误方法:

1
struct Node<int, int> (*nodes)[n] = (struct Node<int, int>(*)[n])std::malloc(sizeof(struct Node<int, int>) * n);

(参考How to dynamically allocate a 2D array in C?malloc申请二维数组的四种方法

Emacs的HOME路径~默认为环境变量“HOME”的值(例如E:\Cadence\SPB_Data),若要为Emacs设置独立的HOME路径需要手动更改。经试验目前中文网络上所谓修改注册表值HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs\HOME=%emacs_dir%无效。

在原有HOME路径下新建.emacs文件并load file的方法经测试无效,例如把.emacs文件写入(参考How do I set a different location for the dot emacs .emacs file on Windows 7?):

1
2
3
4
5
(setq user-init-file "E:/Cadence/SPB_Data")
(setq user-emacs-directory "D:/Documents/Programming/emacshome")
(setq default-directory "D:/Documents/Programming/emacshome")
(setenv "HOME" "D:/Documents/Programming/emacshome")
(load user-init-file)

启动Emacs会报错:

Warning (initialization): An error occurred while loading ‘E:/Cadence/SPB_Data’:

File error: Cannot open load file, Permission denied, e:/Cadence/SPB_Data

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the ‘–debug-init’ option to view a complete error backtrace.

(这里如果将user-init-file设置为其他路径,则该.emacs文件根本不会被使用)

方法一(仍会在原HOME路径下创建空的.emacs.d文件夹):在emacs\share\emacs\site-lisp文件夹下新建site-start.el,写入:

1
2
3
4
5
6
; E:\Program_Files\Emacs\x86_64\share\emacs\site-lisp
(defun set-home-dir (dir)
(setenv "HOME" dir)
(message (format "HOME location is %s" (getenv "HOME"))))

(set-home-dir "D:/Documents/Programming/emacshome/")

启动Emacs即发现HOME目录改为新的目录(参考Change ~ home folder location? (Windows))。

方法二(仍会在原HOME路径下创建空的.emacs.d文件夹):执行

1
SETX EMACS_HOME "D:\Documents\Programming\emacshome"

添加环境变量(这里是用户变量)或手动添加环境变量(系统变量也可以),这里的变量名EMACS_HOME可自己决定,在emacs\share\emacs\site-lisp文件夹下新建site-start.el,写入:

1
2
; E:\Program_Files\Emacs\x86_64\share\emacs\site-lisp
(setenv "HOME" (convert-standard-filename (getenv "EMACS_HOME")))

启动Emacs即发现HOME目录改为新的目录(参考Changing HOME directory only for Emacs (on Windows 7))。

方法三(不会在原HOME路径下创建空的.emacs.d文件夹):添加环境变量名为XDG_CONFIG_HOME,值为要更改为的路径。参考49.4.4 How Emacs Finds Your Init File,Emacs会先按顺序寻找/.emacs.el、/.emacs或/.emacs.d/init.el,Emacs还会寻找init.el的XDG兼容位置,默认为/.config/emacs,该路径可被XDG_CONFIG_HOME环境变量覆盖,其值会替换默认XDG初始化文件名中的/.config,然而,Emacs仍会优先寻找/.emacs.d、/.emacs和/.emacs.el如果它们存在的话,所以需要先删除或重命名这些文件夹或文件以使用XDG位置。如果XDG位置和/.emacs.d都不存在,则Emacs会创建/.emacs.d。设置了XDG_CONFIG_HOME环境变量后,启动Emacs即发现HOME目录改为新的目录。

原因:“usegdlibrary”命令基于TikZ库“graphdrawing”,该库需要LuaTeX/LuaLaTeX支持。

解决方案:如已安装Tex Live,以VS Code为例,在settings.json的“latex-workshop.latex.tools”下添加

1
2
3
4
5
6
7
8
9
10
11
{
"name": "lualatex",
"command": "lualatex",
"args": [
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}

在“latex-workshop.latex.recipes”下添加

1
2
3
4
5
6
{
"name": "LuaLaTeX",
"tools": [
"lualatex"
]
}

点击COMMANDS -> Build LaTeX rpoject -> Recipe: LuaLaTeX编译

画好原理图,Run PSpice运行仿真显示仿真曲线后在菜单栏Trace->Cursor->Display显示Cursor,在图上左键单击为Cursor 1,右键单击为Cursor 2,默认如图示:

img

单击图上的红色菱形图标,Cursor即被切换到红色菱形图标所代表的曲线上(如果单击的是图标右边的表达式,则是选中表达式所代表的曲线),在图上单击到大致位置后通过键盘左右方向键调整到合适的X Values,如图示:

img

若要在打印的PDF等图像中下方显示的Cursor信息从默认的第一条曲线改为第二条曲线,则将鼠标光标 移动至下方Probe Cursor栏的第三行第零列(CURSOR 1单元格左边的控制格)点击拖动第三行向上以至第二行(如果无法拖动,则先右键单击弹出右键菜单,然后左键点击其他地方取消右键菜单,再左键拖动即可拖动),拖动后最好不要点击任何地方(有时候会使得两个CURSOR的位置再次颠倒回原来的顺序),直接在菜单栏中File->Print…(Ctrl+P)打印图形,打印后下方的Cursor信息即被改成了第二条曲线的信息:

img

使用waka-boxwaka-box-go时根据其README配置完成后发现Gist未更新,根据Issue #42需要等WakaTime中有数据后才可以更新,于是等到WakaTime有数据后再查看依旧不更新,根据Issue #61,WakaTime每日更新一次,于是等过了一天Gist依旧不更新,尝试删除了GitHub Access Token、fork的Repository和创建的Gist后重新配置依旧失败,在另一个pinned-gist项目productive-box的README中找到Project Setup的第2步:Open the “Actions” tab of your fork and click the “enable” button,于是在fork的repository中的Actions中选择了启用,等待一天后依旧没有更新Gist。受到Issue #51的启发,进入fork的waka-box仓库的/actions下查看All workflows显示两个results:Update gist with WakaTime stats Update gist with WakaTime stats #1: Scheduled和Update gist with WakaTime stats #2: Scheduled并都有绿色对勾,进入workflow:”Update gist with WakaTime stats”下选择任一个result进入显示1 completed job,左边栏update-gist为绿色对勾状态,点击update-gist下的Update Gist项显示httperror: bad credentials。受到Error: Failed to install ‘unknown package’ from GitHub: HTTP error 401. Bad credentials启发检查Personal access tokens发现之前删除了token,于是重新Generate new token并修改库->Settings->Secrets Update GH_TOKEN后回到Actions下选择最新的result右上角点击Re-run jobs->Re-run all jobs:img等待片刻后任务完成,检查Update Gists项详情:

img

成功运行,此时检查对应Gist发现其已被正确更新。

先检查是否可以裸连github.com,如果不能则可能由于DNS解析的问题,需要等待DNS服务修复。这里更换DNS解析很难解决问题,使用代理虽然可以连接,但是SSH将仍处于不可用的状态。这种情况下参考Solution for ‘ssh: connect to host github.com port 22: Connection timed out’ error【git 端口拒绝解决方案】ssh: connect to host github.com port 22: Connection refused等方式更换端口为443或设置ProxyCommand等方法自然是无效的,等到网络修复好后自然可以顺利使用SSH方式连接。

在Windows CMD或PowerShell中执行git clone命令报错:

1
2
3
4
5
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

该问题只出现在使用SSH方式克隆的情形下。

首先要根据GitHub官方文档Error: Permission denied (publickey)逐一检查排除。经检查,Windows环境中不存在sudo的问题,连接到github.com使用端口22,使用正确的

1
ssh -T git@github.com

并出现成功提示:

1
2
warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)
Hi yihuajack! You've successfully authenticated, but GitHub does not provide shell access.

确认ssh-agent已启动。执行

1
ssh-add -l

显示出2048 SHA256码及正确的id_rsa路径。参考Calculate RSA key fingerprint执行

1
ssh-keygen -lf /path/to/ssh/key

显示出2048 SHA256码及正确的配置邮箱,执行

1
ssh-keygen -E md5 -lf <fileName>

显示出2048 MD5码及正确的配置邮箱。将SHA256码和MD5码与GitHub->Settings->SSH and GPG keys->SSH keys对应的key比较发现完全一致。执行

1
ssh -vT git@github.com

(其中T可省略)显示

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
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\Yihua/.ssh/config
debug1: Connecting to github.com [52.74.223.119] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Yihua/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Yihua/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version babeld-88a6481e
debug1: no match: babeld-88a6481e
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
...
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\Yihua/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
...
debug1: Server accepts key: pkalg ssh-rsa blen 279
warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([52.74.223.119]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi yihuajack! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2560, received 2468 bytes, in 0.8 seconds
4

检查完没有错误后,在WSL Ubuntu中发现可以正常克隆,进一步发现在正确配置Git for Windows (Git Bash)、MSYS2 (MinGW-w64)、Cygwin64后在三个环境中也同样可以正常克隆。Git Bash中显示debug信息如下:

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
OpenSSH_8.3p1, OpenSSL 1.1.1g  21 Apr 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [13.229.188.59] port 22.
debug1: Connection established.
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_rsa type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_rsa-cert type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_dsa type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_dsa-cert type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ecdsa type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ecdsa-cert type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ecdsa_sk type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ed25519 type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ed25519-cert type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ed25519_sk type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_xmss type -1
debug1: identity file /e/Cadence/SPB_Data/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version babeld-88a6481e
debug1: no match: babeld-88a6481e
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
...
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /e/Cadence/SPB_Data/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /c/Users/Yihua/.ssh/id_rsa RSA
...
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_rsa
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_dsa
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_ecdsa
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_ecdsa_sk
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_ed25519
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_ed25519_sk
debug1: Will attempt key: /e/Cadence/SPB_Data/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/Yihua/.ssh/id_rsa RSA
...
debug1: Server accepts key: /c/Users/Yihua/.ssh/id_rsa RSA
...
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([13.229.188.59]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi yihuajack! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2832, received 2468 bytes, in 0.7 seconds
Bytes per second: sent 4004.1, received 3489.4
debug1: Exit status 1

WSL Ubuntu显示信息如下:

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
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/ayka_tsuzuki/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [13.250.177.223] port 22.
debug1: Connection established.
debug1: identity file /home/ayka_tsuzuki/.ssh/id_rsa type 0
debug1: identity file /home/ayka_tsuzuki/.ssh/id_rsa-cert type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_dsa type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_dsa-cert type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ecdsa type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ed25519 type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ed25519-cert type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ed25519_sk type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_xmss type -1
debug1: identity file /home/ayka_tsuzuki/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version babeld-88a6481e
debug1: no match: babeld-88a6481e
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
...
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/ayka_tsuzuki/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_rsa RSA
...
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_dsa
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_ecdsa
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_ed25519
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/ayka_tsuzuki/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/ayka_tsuzuki/.ssh/id_rsa RSA
...
debug1: Server accepts key: /home/ayka_tsuzuki/.ssh/id_rsa RSA
...
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([13.250.177.223]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = C.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi yihuajack! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2796, received 2468 bytes, in 0.7 seconds
Bytes per second: sent 3818.8, received 3370.8
debug1: Exit status 1

发现在git-cmd.exe(cmd)也就是Windows CMD/PowerShell使用的git中使用git clone验证RSA key fingerprint自动创建在HOME环境变量目录下也就是E:/Cadence/SPB_Data下.ssh/known_hosts,如果在git-bash.exe(bash)中配置export HOME=C:/Users/则会自动完成ssh-add的工作。参考安装适用于 Windows Server 2019 和 Windows 10 的 OpenSSH使用PowerShell安装Win32-OpenSSH后参考Configure SSH Key and Git Integration WithWindows 10 Native Way该问题仍然存在。由此可以确定这是由于HOME被设置成环境变量指向另一个文件夹所致,尽管执行echo $HOME命令会指向正确的个人文件夹,debug信息也均指向正确的个人文件夹。同时,即使允许其在HOME环境变量文件夹下新建.ssh/known_hosts,该问题仍然会出现。此外,使用setx命令或手动在控制面板中创建/修改HOME环境变量或删除HOME环境变量无济于事。

最终解决方案(参考SSH is looking in the wrong place for the public/private key pair on Windows):

将Git安装目录下的/etc/nsswitch.conf中的db_home一行由

1
db_home: env windows cygwin desc

修改为

1
db_home: /%H

成功解决。

后记:将Win32-OpenSSH解压到C:\Program Files\下后将其环境变量添加并上移到C:\WINDOWS\System32\OpenSSH\之前,再次执行ssh -v git@github.com,显示已使用新版的OpenSSH for Windows:

1
OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2

Windows环境下执行

1
ssh-add ~/.ssh/id_rsa

报错:

1
Error connecting to agent: No such file or directory

解决方法:【以管理员身份运行】执行

1
2
Set-Service ssh-agent -StartupType Manual
Start-Service ssh-agent

  1. 注册并登录LeanCloud。参考官方文档https://valine.js.org/quickstart.html创建开发版应用。

  2. 执行

    1
    npm install valine -g

    安装valine。

  3. Release页面下载安装lean-cli-setup-x64.msi。

  4. 如出现

    1
    2
    获取 Class 列表失败
    The app is archived, please restore in console before use. [400 GET /data/6pVKQMTaE6R44OanMdxlS9Ku-gzGzoHsz/classes]

    参考获取 Class 列表失败 - 急在线等激活应用,在存储服务数据恢复中:“归档应用恢复中,该操作大约需要 10-30 分钟”,但实际上很快就能恢复。

  5. 使用Valine-Admin参考官方文档:https://deserts.io/valine-admin-document/。注意第1步新版LeanCloud以迁移到LeanEngine->WEB->部署->部署->部署项目->Git部署,填写对应博客的GitHub仓库的HTTP链接或SSH链接,将其给出的Deploy Key添加到自己GitHub账号的SSH Key中。在“设置”下添加环境变量(包括ADMIN_URL)。返回“部署”,选择手动部署,选择目标环境为生产环境(也仅可选择生产环境),选择分支或提交为默认的”master”,保持hexo服务器处于开启状态,点击部署。

  6. 将设置->应用Keys中的AppID和AppKey复制到next主题的_config.yml中的valine项下,enable设置为true,language设置为en, zh-cn,visitor设置为true,recordIP设置为false。重新部署hexo评论系统即成功添加。

  7. 【deprecated】安装hexo-admin:

    1
    npm install hexo-admin --save
  8. 安装hexo-filter-github-emojis以支持emoji渲染(无需卸载也切勿卸载hexo-renderer-ejs和hexo-renderer-marked,否则可能会出现“1 vulnerability requires manual review. See the full report for details.”这类无法修复的问题)

    1
    npm install hexo-filter-github-emojis --save

    同样切记一定要使用–save选项,不要全局安装。在Hexo _config.yml中添加

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    githubEmojis:
    enable: true
    className: github-emoji
    inject: true
    # unicode: true
    styles:
    # display: inline
    # vertical-align: middle
    # localEmojis:
    customEmojis:
  9. 添加coding.me仓库同步托管:在Hexo _config.yml的deploy项下的repo项下新增

    1
    coding: git@e.coding.net:ayka/ayka.coding.me.git,master

    参考Hexo在GitHub和Coding双线部署教程设置coding.net项目(ps.在遇到这篇文章之前一度以为coding.net已取消了静态页面功能),如有需要自己配置域名也可参考该文章。
    使用GitHub注册Vercel。在Import a Git Repository界面输入github.io仓库地址,FRAMEWORK PRESET选择Hexo,环境变量留空。
    Coding新建仓库,并新建访问令牌。将Hexo _config.yml的deploy项下的repo项下更改为github: https://@github.com//.github.io.git和coding: https://<令牌用户名>:<访问令牌>@e.coding.net///.git。在Hexo blog目录下执行

    1
    git init

    执行

    1
    git remote add origin https://<令牌用户名>:<访问令牌>@e.coding.net/<username>/<reponame>/<reponame>.git

    如报错

    1
    fatal: remote origin already exists.

    则执行

    1
    git remote rm origin

    后重新git remote add。执行

    1
    2
    3
    git submodule add https://github.com/theme-next/hexo-theme-next themes/next
    git commit -m 'Initial commit'
    git push -u origin master

    打开项目设置->功能开关->持续集成,返回项目页面刷新后选择持续集成->构建计划->新建构建计划->选择构建计划模板->自定义构建过程,填写构建计划名称,构建过程->代码仓库选择之前用来存放博客源码的仓库,配置来源选择使用静态配置的Jenkinsfile确定后在流程配置->文本编辑器中添加:

    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
    pipeline {
    agent any
    stages {
    stage('克隆项目') {
    steps {
    sh 'git clone https://oNTAWaPDGB:49028867e0b47d1b2a19b128396b89f43cf13df2@e.coding.net/ayka/hexoblog/hexoblog.git'
    sh 'ls -a'
    }
    }
    stage('安装依赖') {
    steps {
    sh 'ls -a'
    sh 'npm install -g hexo-cli'
    sh 'npm install hexo --save'
    sh 'npm install'
    }
    }
    stage("构建发布") {
    steps {
    sh 'hexo clean && hexo g && hexo d'
    }
    }
    stage('检出') {
    steps {
    checkout([
    $class: 'GitSCM',
    branches: [[name: env.GIT_BUILD_REF]],
    userRemoteConfigs: [[
    url: env.GIT_REPO_URL,
    credentialsId: env.CREDENTIALS_ID
    ]]])
    }
    }
    stage('自定义构建过程') {
    steps {
    echo '自定义构建过程开始'
    }
    }
    }
    }

    触发规则->代码源触发选择推送到master时触发构建保存修改。
    注册Cloud Studio(可直接使用coding.net账号登录)。新建工作空间(我自己创建),运行环境->预置环境选择Node,js,代码来源选择仓库,填写博客源码库的SSH。
    进入工作空间,在终端中执行

    1
    2
    3
    npm install -g hexo-cli
    npm install hexo --save
    npm install

    即可生成。

  10. 设置背景图片、半透明效果、博主头像实现圆形并旋转360°参考Hexo+Next7.X 博客美化教程合集

  11. 参考为Hexo增加algolia搜索功能。其中设置环境变量时如果使用Windows环境则将export命令改为执行

    1
    setx HEXO_ALGOLIA_INDEXING_KEY your_api_key

    后重启Terminal。另可选增加本地搜索功能参考hexo删除algolia搜索增加本地搜索功能

    注意:每次添加新的博文生成前都需执行

    1
    hexo algolia

    以刷新索引。

  12. 【deprecated】执行

    1
    git clone https://github.com/theme-next/theme-next-canvas-nest source/lib/canvas-nest

    并在Next _config.yml中添加相关配置后启动服务器会报错:

    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
    Unhandled rejection Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig) [Line 36, Column 23]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig) [Line 39, Column 18]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\head\head-unique.swig) [Line 10, Column 23]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig) [Line 3, Column 3]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\index.swig) [Line 6, Column 15]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\sub-menu.swig) [Line 2, Column 29]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\sub-menu.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig) [Line 5, Column 3]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig) [Line 10, Column 14]
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\pagination.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\comments.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\index.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\languages.swig)
    Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\footer.swig) [Line 63, Column 8]
    parseAggregate: expected comma after expression
    at Object._prettifyError (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\lib.js:36:11)
    at D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:561:19
    at Template.root [as rootRenderFunc] (eval at _compile (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:631:18), <anonymous>:43:3)
    at Template.render (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:550:10)
    at D:\Documents\Programming\HexoBlog\themes\next\scripts\renderer.js:32:29
    at _View._compiled (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\theme\view.js:136:50)
    at _View.render (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\theme\view.js:39:17)
    at D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\hexo\index.js:64:21
    at tryCatcher (D:\Documents\Programming\HexoBlog\node_modules\bluebird\js\release\util.js:16:23)
    at D:\Documents\Programming\HexoBlog\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\hexo\router.js:47:5)
    at RouteStream.Readable.read (_stream_readable.js:467:10)
    at resume_ (_stream_readable.js:981:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

    Next已将canvas-nest配置废弃。

  13. 执行

    1
    npm install hexo-related-popular-posts --save

    配置Next _config.yml中的related_posts项如下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    related_posts:
    enable: true
    title: 相关文章 # Custom header, leave empty to use the default one
    display_in_home: false
    params:
    maxCount: 5
    #PPMixingRate: 0.0
    isDate: true
    #isImage: false
    #isExcerpt: false
  14. 执行

    1
    git clone https://github.com/theme-next/theme-next-fancybox3 themes/next/source/lib/fancybox

    安装fancybox。在Next _config.yml中配置fancybox项设置值为true。

  15. 参考Hexo+next主题自定义友情链接页面注意:如果执行hexo clean后重新生成仍然显示之前的页面,需要关闭浏览器页面重新生成后打开。

  16. 参考SEO优化:Hexo-abbrlink插件生成永久固定链接。另外可使用hexo-abbrlink2

  17. 使用PicGo图床。安装后设置GitHub图床设定仓库名为/.github.io,设定分支名为master,设定Token需要在GitHub Settings->Developer Settings->Personal access tokens->Generate new token,其中Select repos只需选定repo项即可,将生成的token填入设定Token中。改进:新建GitHub仓库并将仓库名填入设定仓库名中,指定存储路径为img/,设定自定义域名为https://cdn.jsdelivr.net/gh//@master

  18. 执行

    1
    npm install hexo-asset-image --save

    在Hexo _config.yml中的post_asset_folder设为true。执行hexo new 发现其会自动创建一个同名的文件夹。在Typora->偏好设置->图像->插入图片时输入路径为D:\Documents\Programming\HexoBlog\source\_posts${filename},前面的路径改为你所在的博客的路径,注意source与_post直接必须加两个反斜杠,否则hexo会将其转义成source_posts导致图片显示失败。如果要将之前的博文图片添加到asset文件夹中,只需手动创建同名文件夹,并将其中插入的图片放在该文件夹里面,在Typora中修改Markdown文件中图片所在路径即可。这种修改可在服务器运行时生效:

    1
    update link as:-->/posts/52215/Documents\Programming\HexoBlog\source\_posts\CSDN补档-16\20200315101839605.png

  1. 新建GitHub仓库名为.github.io。

  2. 安装Node.js及Git。

  3. 安装hexo:

    1
    npm install -g hexo-cli
  4. 切换到要保存hexo博客的目录,执行

    1
    hexo init

    或直接执行

    1
    2
    hexo init <folder>
    cd <folder>

    然后执行

    1
    npm install
  5. 安装主题,以Next为例:切换到博客文件夹下后执行

    1
    git clone https://github.com/theme-next/hexo-theme-next themes/next
  6. 编辑/_config.yml,填写title、subtitle、description、keywords、author、language。将url填写为http://.github.io。如果之前使用的是旧版hexo需要参考Hexo版本升级和Next主题升级之坑更新后在time_format后添加update_option: ‘mtime’。将theme改为next。添加plugin:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    plugin:
    - hexo-generator-feed
    feed:
    type: atom
    path: atom.xml
    limit: 20
    search:
    path: search.xml
    field: post
    format: html
    limit: 10000

    添加Deployment配置:

    1
    2
    3
    4
    deploy:
    type: git
    repository: https://github.com/<username>/<username>.github.io.git
    branch: master
  7. 编辑/themes/next。更改scheme: Pisces。启用Dark Mode:将darkmode设置为true。启用commonweal等目录,将相应句子前的注释井号删掉。修改social配置,其中Google一栏plus.google已停用。links: Title:可添加其他地址。follow_me配置会在每篇文章末尾添加一个图标指向各个网站的链接,没必要。calendar配置将calendar_id改为Google邮箱,api_key需要在Google API Console,新建项目,然后在“API和服务”一栏下的“信息中心”一栏的页面中选择“ENABLE APIS AND SERVISES”如图:img
    搜索API和服务:img
    搜索Google Calendar:img
    点击Google Calendar API后点击“启用”,然后“创建凭据”:img
    点击“选择”选择Google Calendar API,然后点击“API密钥”创建。
    github_banner配置中将enable设置为true,permalink设置为https://github.com/。将pjax设置为true。

  8. 新建博文:执行

    1
    hexo new CSDN-1

    会显示

    1
    INFO  Created: D:\Documents\Programming\Aykablog\source\_posts\CSDN-1.md

    其中标准命令为

    1
    hexo new [layout] <title>

    [layout]可选项默认为post。

  9. 执行

    1
    hexo generate

    1
    hexo g

    显示

    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    INFO  Start processing
    INFO Files loaded in 370 ms
    INFO Deleted: images/arrow-right-32x32-next.png
    INFO Deleted: images/arrow-right-16x16-next.png
    INFO Deleted: images/arrow-right.eps
    INFO Deleted: images/arrow-right.png
    INFO Deleted: lib/font-awesome/HELP-US-OUT.txt
    INFO Deleted: lib/font-awesome/css/font-awesome.css.map
    INFO Deleted: images/arrow-right.svg
    INFO Deleted: images/quote-l.svg
    INFO Deleted: images/quote-r.svg
    INFO Deleted: lib/font-awesome/bower.json
    INFO Deleted: lib/font-awesome/fonts/fontawesome-webfont.woff
    INFO Deleted: lib/font-awesome/fonts/fontawesome-webfont.woff2
    INFO Deleted: lib/font-awesome/css/font-awesome.css
    INFO Deleted: lib/font-awesome/css/font-awesome.min.css
    INFO Deleted: lib/font-awesome/fonts/fontawesome-webfont.eot
    INFO Deleted: images/arrow-right.ico
    INFO Deleted: images/41254968094E73320D03EFF9B33277C03C1168186.jpg
    INFO Generated: content.json
    INFO Generated: board/index.html
    INFO Generated: about/index.html
    INFO Generated: tags/index.html
    INFO Generated: categories/index.html
    INFO Generated: archives/index.html
    INFO Generated: archives/2020/index.html
    INFO Generated: archives/2020/03/index.html
    INFO Generated: tags/tutorial/index.html
    INFO Generated: 2020/03/18/hello-world/index.html
    INFO Generated: 2020/03/19/paper/index.html
    INFO Generated: index.html
    INFO Generated: js/algolia-search.js
    INFO Generated: js/schemes/muse.js
    INFO Generated: js/next-boot.js
    INFO Generated: js/bookmark.js
    INFO Generated: js/local-search.js
    INFO Generated: css/main.css
    INFO Generated: js/schemes/pisces.js
    INFO Generated: js/utils.js
    INFO Generated: lib/pjax/index.d.ts
    INFO Generated: lib/font-awesome/webfonts/fa-regular-400.woff2
    INFO Generated: lib/pjax/LICENSE
    INFO Generated: lib/pjax/lib/abort-request.js
    INFO Generated: lib/pjax/example/example.js
    INFO Generated: lib/pjax/lib/execute-scripts.js
    INFO Generated: lib/pjax/package.json
    INFO Generated: lib/pjax/lib/is-supported.js
    INFO Generated: lib/font-awesome/css/all.min.css
    INFO Generated: lib/pjax/index.js
    INFO Generated: lib/pjax/lib/foreach-selectors.js
    INFO Generated: lib/pjax/lib/foreach-els.js
    INFO Generated: lib/pjax/CHANGELOG.html
    INFO Generated: lib/pjax/lib/parse-options.js
    INFO Generated: lib/pjax/lib/eval-script.js
    INFO Generated: lib/pjax/example/page2.html
    INFO Generated: lib/pjax/lib/send-request.js
    INFO Generated: lib/pjax/example/page3.html
    INFO Generated: lib/pjax/example/forms.html
    INFO Generated: lib/pjax/pjax.js
    INFO Generated: lib/font-awesome/webfonts/fa-brands-400.woff2
    INFO Generated: lib/pjax/example/index.html
    INFO Generated: lib/pjax/README.html
    INFO Generated: lib/font-awesome/webfonts/fa-solid-900.woff2
    INFO Generated: lib/pjax/pjax.min.js
    INFO Generated: lib/pjax/tests/setup.js
    INFO Generated: lib/pjax/lib/switches-selectors.js
    INFO Generated: lib/pjax/lib/uniqueid.js
    INFO Generated: lib/pjax/lib/events/trigger.js
    INFO Generated: lib/pjax/lib/switches.js
    INFO Generated: lib/pjax/tests/test.ts
    INFO Generated: lib/pjax/lib/events/on.js
    INFO Generated: lib/pjax/lib/proto/parse-element.js
    INFO Generated: lib/pjax/lib/events/off.js
    INFO Generated: lib/pjax/lib/proto/log.js
    INFO Generated: lib/pjax/lib/proto/attach-form.js
    INFO Generated: lib/pjax/lib/util/extend.js
    INFO Generated: lib/pjax/lib/proto/attach-link.js
    INFO Generated: lib/pjax/lib/proto/handle-response.js
    INFO Generated: lib/pjax/lib/util/contains.js
    INFO Generated: lib/pjax/lib/util/clone.js
    INFO Generated: lib/pjax/lib/util/update-query-string.js
    INFO Generated: lib/pjax/lib/util/noop.js
    INFO Generated: lib/pjax/tests/lib/proto/attach-form.js
    INFO Generated: lib/pjax/tests/lib/util/clone.js
    INFO Generated: lib/pjax/tests/lib/eval-scripts.js
    INFO Generated: lib/pjax/tests/lib/abort-request.js
    INFO Generated: lib/pjax/tests/lib/is-supported.js
    INFO Generated: lib/pjax/tests/lib/execute-scripts.js
    INFO Generated: lib/pjax/tests/lib/foreach-els.js
    INFO Generated: lib/pjax/tests/lib/foreach-selectors.js
    INFO Generated: lib/pjax/tests/lib/parse-options.js
    INFO Generated: lib/pjax/tests/lib/events.js
    INFO Generated: lib/pjax/tests/lib/switches.js
    INFO Generated: lib/pjax/tests/lib/util/contains.js
    INFO Generated: lib/pjax/tests/lib/switch-selectors.js
    INFO Generated: lib/pjax/tests/lib/uniqueid.js
    INFO Generated: lib/pjax/tests/lib/send-request.js
    INFO Generated: lib/pjax/tests/lib/util/noop.js
    INFO Generated: lib/pjax/tests/lib/util/extend.js
    INFO Generated: lib/pjax/tests/lib/proto/attach-link.js
    INFO Generated: lib/pjax/tests/lib/proto/parse-element.js
    INFO Generated: lib/pjax/tests/lib/util/update-query-string.js
    INFO Generated: lib/pjax/tests/lib/proto/handle-response.js
    INFO 84 files generated in 932 ms
  10. 执行

    1
    hexo server

    1
    hexo s

    显示

    1
    2
    INFO  Start processing
    INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

    打开浏览器打开该网址即可预览。

  11. 如果没有更新,则需要执行

    1
    hexo clean

    后重新生成并启动服务器。

  12. 执行

    1
    npm install hexo-deployer-git --save

    注意此处必须为–save选项,全局安装无效报错:

    1
    2
    INFO  Validating config
    ERROR Deployer not found: git

    执行

    1
    hexo deploy

    1
    hexo d

    将博客部署到GitHub上:

    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    INFO  Validating config
    INFO Deploying: git
    INFO Setting up Git deployment...
    Initialized empty Git repository in D:/Documents/Programming/HexoBlog/.deploy_git/.git/
    [master (root-commit) 9cfa1ad] First commit
    1 file changed, 0 insertions(+), 0 deletions(-)
    create mode 100644 placeholder
    INFO Clearing .deploy_git folder...
    INFO Copying files from public folder...
    INFO Copying files from extend dirs...
    warning: LF will be replaced by CRLF in 2019/07/27/CSDN-1/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in 2020/03/19/paper/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in 2020/09/27/CSDN-2/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in 2020/09/28/hello-world/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in about/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in archives/2019/07/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in archives/2019/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in archives/2020/03/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in archives/2020/09/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in archives/2020/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in archives/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in board/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in categories/CSDN/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in categories/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in css/main.css.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/algolia-search.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/bookmark.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/local-search.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/motion.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/next-boot.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/schemes/muse.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/schemes/pisces.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in js/utils.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in lib/anime.min.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in lib/font-awesome/css/all.min.css.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in lib/velocity/velocity.min.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in lib/velocity/velocity.ui.min.js.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in tags/Adobe/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in tags/Adobe安装错误/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in tags/Visual-Studio-Installer-Error/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in tags/index.html.
    The file will have its original line endings in your working directory
    warning: LF will be replaced by CRLF in tags/tutorial/index.html.
    The file will have its original line endings in your working directory
    [master 1d6cbde] Site updated: 2020-09-28 00:53:37
    50 files changed, 15669 insertions(+)
    create mode 100644 2019/07/27/CSDN-1/index.html
    create mode 100644 2020/03/19/paper/index.html
    create mode 100644 2020/09/27/CSDN-2/index.html
    create mode 100644 2020/09/28/hello-world/index.html
    create mode 100644 about/index.html
    create mode 100644 archives/2019/07/index.html
    create mode 100644 archives/2019/index.html
    create mode 100644 archives/2020/03/index.html
    create mode 100644 archives/2020/09/index.html
    create mode 100644 archives/2020/index.html
    create mode 100644 archives/index.html
    create mode 100644 board/index.html
    create mode 100644 categories/CSDN/index.html
    create mode 100644 categories/index.html
    create mode 100644 css/main.css
    create mode 100644 images/algolia_logo.svg
    create mode 100644 images/apple-touch-icon-next.png
    create mode 100644 images/avatar.gif
    create mode 100644 images/cc-by-nc-nd.svg
    create mode 100644 images/cc-by-nc-sa.svg
    create mode 100644 images/cc-by-nc.svg
    create mode 100644 images/cc-by-nd.svg
    create mode 100644 images/cc-by-sa.svg
    create mode 100644 images/cc-by.svg
    create mode 100644 images/cc-zero.svg
    create mode 100644 images/favicon-16x16-next.png
    create mode 100644 images/favicon-32x32-next.png
    create mode 100644 images/logo.svg
    create mode 100644 index.html
    create mode 100644 js/algolia-search.js
    create mode 100644 js/bookmark.js
    create mode 100644 js/local-search.js
    create mode 100644 js/motion.js
    create mode 100644 js/next-boot.js
    create mode 100644 js/schemes/muse.js
    create mode 100644 js/schemes/pisces.js
    create mode 100644 js/utils.js
    create mode 100644 lib/anime.min.js
    create mode 100644 lib/font-awesome/css/all.min.css
    create mode 100644 lib/font-awesome/webfonts/fa-brands-400.woff2
    create mode 100644 lib/font-awesome/webfonts/fa-regular-400.woff2
    create mode 100644 lib/font-awesome/webfonts/fa-solid-900.woff2
    create mode 100644 lib/velocity/velocity.min.js
    create mode 100644 lib/velocity/velocity.ui.min.js
    delete mode 100644 placeholder
    create mode 100644 tags/Adobe/index.html
    create mode 100644 "tags/Adobe\345\256\211\350\243\205\351\224\231\350\257\257/index.html"
    create mode 100644 tags/Visual-Studio-Installer-Error/index.html
    create mode 100644 tags/index.html
    create mode 100644 tags/tutorial/index.html
    Enumerating objects: 91, done.
    Counting objects: 100% (91/91), done.
    Compressing objects: 100% (66/66), done.
    Writing objects: 100% (91/91), 260.02 KiB | 6.84 MiB/s, done.
    Total 91 (delta 24), reused 0 (delta 0), pack-reused 0
    remote: Resolving deltas: 100% (24/24), done.
    To https://github.com/yihuajack/yihuajack.github.io.git
    + dd9b4c5...1d6cbde HEAD -> master (forced update)
    Branch 'master' set up to track remote branch 'master' from 'https://github.com/yihuajack/yihuajack.github.io.git'.
    INFO Deploy done: git
  13. 编辑/source/about/index.md即为“关于”页面。

  14. 编辑/source/_posts下的相应Markdown文件即可编辑博文。在开头的Front-matter部分可以通过title编辑标题、date编辑日期、tags编辑标签、categories编辑分类。如果多条tags或categories使用语法:

    1
    2
    3
    4
    5
    categories:
    - Diary
    tags:
    - PS3
    - Games

    参考官方文档:https://hexo.io/zh-cn/docs/。