0


hexo+github框架

首先要装nade.js和github

一、环境准备

1、安装Node.js

直接到官网上下载安装即可Download | Node.js

Node.js (Node.js 版本需不低于 10.13,建议使用 Node.js 12.0 及以上版本) Node自带npm

2、安装Git

Windows:下载并安装 git. Mac:使用 Homebrew, MacPorts 或者下载 安装程序。 Linux (Ubuntu, Debian):sudo apt-get install git-core Linux (Fedora, Red Hat, CentOS):sudo yum install git-core 原文链接:Hexo-零基础搭建个人博客(详解)_〆清峰ㄟ的博客-CSDN博客_hexo

然后通过windows键+R,通过cmd进入,再输入一下命令验证:

C:\Users\asus>node -v
v18.12.1
​
C:\Users\asus>npm -v
8.19.2
​
C:\Users\asus>git --version
git version 2.38.0.windows.1
C:\Users\asus>npm install hexo-cli -g(下载hexo)
​
added 59 packages, and audited 60 packages in 9s
​
15 packages are looking for funding
  run `npm fund` for details
​
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.2.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.2.0
npm notice Run npm install -g [email protected] to update!
npm notice
​
C:\Users\asus>hexo -v
hexo-cli: 4.3.0
os: win32 10.0.22000
node: 18.12.1
v8: 10.2.154.15-node.12
uv: 1.43.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.18.1
modules: 108
nghttp2: 1.47.0
napi: 8
llhttp: 6.0.10
openssl: 3.0.7+quic
cldr: 41.0
icu: 71.1
tz: 2022b
unicode: 14.0
ngtcp2: 0.8.1
nghttp3: 0.7.0

搭建仓库

1、输入用户名

1.1 用户名不能使用中文,只能包含字母、数字字符或单连字符(-),不能以连字符开头或结尾。

1.2 用户名不能和已有名称重复,假如用户名重复会给出名称重复的提示并且给出若干可用的用户名进行选择。

2、输入邮箱

2.1 邮箱必须是有效邮箱,建议使用常用邮箱。

2.2 账号注册验证、找回密码、修改密码等账号相关操作都需要使用邮箱。

3、输入密码

3.1 密码中仅包含数字或者仅包含字母,那么最少需要15位字符。

3.2 密码中既包含数字,又包含字母,那么最少需要8位字符。

3.3 不可使用连续字符(123456、asdfgh、asdfghj)等字符串。

3.4 建议使用大小写+数字+标点符号的密码

4、电子邮件选项(Email preferences)

5、人机交互验证(Verify your account)

用来验证是人为注册还是机器人注册,防止恶意注册

6、完成以上步骤后,点击【Create account】注册账号

7、创建仓库

创建仓库需要你的github的用户名+.github.io,并且点击下面第一个有file的选项后生成仓库。

SSH Keys

在C盘用户里面找.ssh文件,就有这个。如果没有就右键Git Bash here

输入以下命令

$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/asus/.ssh/id_rsa):
/c/Users/asus/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/asus/.ssh/id_rsa
Your public key has been saved in /c/Users/asus/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:cgTIDugHJZbm1gdXkzTlho3qPQ8/KbQ+3PsHmk48jyM [email protected]
The key's randomart image is:
+---[RSA 3072]----+
| +oo .+=o.       |
|o+o.o. oB        |
|+ ooo  o.+       |
| + o.....        |
|. . ... S        |
|    . .+.  .     |
|     .o+o++ .    |
|       E*B+  .   |
|      ..=*=o.    |
+----[SHA256]-----+

打开.ssh中的puh的那个,用记事本打开,复制所有内容。

打开github,点击头像下面三角,在里面的找到setting并点击,

随后,找到ssh公钥,建立新的密钥。名称自己定,复制内容粘贴到下面方框中去,点击新建即可完成。

本地生成博客内容

打开一个文件,右键点Git Bush here,输入以下命令

hexo init #初始化
​
$ hexo s
INFO  Validating config
INFO  Start processing
INFO  Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

发布博客到互联网

打开config-yml,粘贴以下内容:

deploy:
  type: git
  repository: 这个去新建仓库找自己的域名
  branch: main

推送hexo站点文件 之后就可以推送博客站点到gitee上了

推送命令 hexo d

其中 hexo clean清除了你之前生成的东西,也可以不加。 hexo generate 顾名思义,生成静态文章,可以用 hexo g缩写 hexo deploy 部署文章,可以用hexo d缩写

标签: git

本文转载自: https://blog.csdn.net/Williamtym/article/details/128335620
版权归原作者 Williamtym 所有, 如有侵权,请联系我们删除。

“hexo+github框架”的评论:

还没有评论