在另一台电脑上部署hexo

参考文献https://www.yyyzyyyz.cn/posts/e9f450947913/

git绑定邮箱

之前上传过代码到gitee上,就自动绑定了。
上传时绑定:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
git remote add origin https://gitee.com/creek19/test2.git
```
>查看绑定的邮箱:
```bash
git config user.email
```
>查看全局绑定的邮箱:
```bash
git config --global user.email
```
>修改Git邮箱配置:
```bash
git config --global user.email "your_email@example.com"
```
## 安装node.js和npm
- 检测Node.js,`node -v`
- 检测npm,`npm -v`

## 安装Hexo
### 因为`dependencies`里有hexo,所以只要下载`hexo-cli`就行
```bash
npm install -g hexo-cli

安装时没权限

用管理员权限打开cmd在nodejs文件夹D:\program Files\nodejs\node_cache\node_modules\ 里下载

下载package.json里的依赖

1
npm install

运行项目

1
npm run server

部署项目

本地创建密钥

  • 在本机电脑终端输入:
    1
    ssh-keygen -t rsa
  • 一直摁回车
  • 复制id_rsa.pub文件中的内容

服务器添加密钥

  • /home/wcy/.ssh/authorized_keys里添加本地的密钥

    没有格式,看起来方便可以换一行

部署

在package.json中点击调试选择deploy就行,或者在C:\Users\yangwen\Desktop\编程项目\hexo\hexo>目录下,运行npm run deploy