基础
1nodejs
1.1epress
安装epress
1.2安装hexo
1.1.3.ssh id_rea密钥
将此公钥的.pub内容链接到github
韩东平@LAPTOP-KVSU7GCB MINGW64 /d/Blog
$ ssh-keygen -t rsa -C "你的邮箱"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/韩东平/.ssh/id_rsa):
/c/Users/韩东平/.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/韩东平/.ssh/id_rsa
Your public key has been saved in /c/Users/韩东平/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:vix595FLbq2EuKf5lPy5sPv9W6MsB5eOyr2EVJ7vc+I handongping020820@126.com
The key's randomart image is:
+---[RSA 3072]----+
| |
| |
| . |
| o . |
| S. o . |
| ..o.+.+ |
| .o.*.Xo ..|
| o.o==X+Xo.o|
| o*B=B#E=oo|
+----[SHA256]-----+
韩东平@LAPTOP-KVSU7GCB MINGW64 /d/Blog
$ ssh -T git@github.com
git@github.com: Permission denied (publickey).
韩东平@LAPTOP-KVSU7GCB MINGW64 /d/Blog
ssh -T git@github.com #查看是否成功
2git
2.1初始化hexo问题--网络问题
可以挂载镜像源
可以你懂的,会方便的多,没有的话可以尝试一下方法
2.1.1解救方法一 初始化为另一个名字
正常初始化报错
韩东平@LAPTOP-KVSU7GCBMINGW64/d/Blog
hexo init
##下面是报错
INFO Cloninghexo-starterhttps://github.com/hexojs/hexo-starter.git
fatal:unabletoaccess'https://github.com/hexojs/hexo-starter.git/':SSLcertificateproblem:unabletogetlocalissuercertificate
WARN gitclonefailed.Copyingdatainstead
FATAL{
err:[Error:EPERM:operationnotpermitted,mkdir'D:\']{
errno:-4048,
code:'EPERM',
syscall:'mkdir',
path:'D:\\'
}
}Something's wrong. Maybe you can find the solution here: %s http://hexo.io/docs/troubleshooting.html
韩东平@LAPTOP-KVSU7GCBMINGW64/d/Blog
$hexoinitxp ##初始化为另一个名字
INFO Cloninghexo-starterhttps://github.com/hexojs/hexo-starter.git
fatal:unabletoaccess'https://github.com/hexojs/hexo-starter.git/':SSLcertificateproblem:unabletogetlocalissuercertificate
WARN gitclonefailed.Copyingdatainstead
INFO Installdependencies
2.2.2npx方法初始化
韩东平@LAPTOP-KVSU7GCBMINGW64/d/Blog
npx hexo init blog
INFO Cloninghexo-starterhttps://github.com/hexojs/hexo-starter.git
fatal:unabletoaccess'https://github.com/hexojs/hexo-starter.git/':SSLcertificateproblem:unabletogetlocalissuercertificate
WARN gitclonefailed.Copyingdatainstead
INFO Installdependencies
这样就解决了初始化的问题
2.2.3hexo框架已完成
##修改congfig.ynl文件
deploy:
type: git
repository: https://github.com/xpssssss/xpssssss.github.io.git##你的仓库
branch: main
2.2.4启动本地服务器
韩东平@LAPTOP-KVSU7GCB MINGW64 /d/Blog/myblog
hexo g
hexo server
#一下是出来的信息
INFO Validating config
INFO Start processing
INFO Files loaded in 54 ms
INFO 0 files generated in 13 ms
INFO Validating config
INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
在本地启动服务器后,复制http://localhost:4000到浏览器就可以看到博客初始界面了
2.2.5hexo d问题部署问题
问题
hexo d
报错:
INFO Validating config
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
On branch master
## nothing to commit, working tree clean
fatal: unable to access 'https://github.com/xpssssss/xpssssss.github.io.git/': SSL certificate problem: unable to get local issuer certificate
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (D:\Blog\myblog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:513:28)
at cp.emit (D:\Blog\myblog\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
解决方法
git config --global user.email "你的邮箱"
git config --global user.name "github用户名字"
扩展:
其中 hexo clean清除了你之前生成的东西,也可以不加。
hexo generate 顾名思义,生成静态文章,可以用 hexo g缩写
hexo deploy 部署文章,可以用hexo d缩写
hexo server 部署
2.3gitte国内解决版本
2.4github
这是最便捷的方法,亲测,实际搭建非常简单
以上就是搭建过程中常见的错误,希望大家平安顺利完成学习过程。