发现自己走马观花的"本身"还是有的,到处瞎逛,猛然回想起自己曾在GitHub上是搭建过Hexo轻博客的。我是想过"乔迁"的吧。那就把wenqy.github.io的建站搬过来吧。
hexo命令
安装
hexo,命令安装
$ npm install -g hexo
初始化
$ hexo init
新建文章
$ hexo new "hello wenqy"
生成静态页面
$ hexo generate
启动本地服务
$ hexo server
默认端口:4000
github部署
修改配置文件
修改全局配置文件:_config.yml
deploy:
type: git
repo: http://github.com/wenqy/wenqy.gihub.io.git
branch: master
部署
github上创建wenqy.gihub.io仓库
$ npm install hexo-deployer-git --save
可以使用__SSH Keys__,然后执行
$ hexo deploy
前置条件
git
安装Gitgit-for-windows.github.io,配置git环境变量
ssh keys
keys生成
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$ cd ~
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$ ssh-keygen -t rsa -C "xxxxxx@xx.com" #邮箱
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/xxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/xxx/.ssh/id_rsa.
Your public key has been saved in /c/Users/xxx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:xxxxx xxxxxx@xx.com
The key's randomart image is:
+---[RSA 2048]----+
| xxxx|
+----[SHA256]-----+
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$ ssh-keygen -t rsa -C "xxxxxx@xx.com" -f ~/.ssh/github_blog_keys #指定文件
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/xxx/.ssh/github_blog_keys.
Your public key has been saved in /c/Users/xxx/.ssh/github_blog_keys.pub.
The key fingerprint is:
SHA256:xxxxx xxxxxx@xx.com
The key's randomart image is:
+---[RSA 2048]----+
|xxxx |
+----[SHA256]-----+
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$ git config --global user.name "wenqy"
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$ git config --global user.email "xxxxx@xx.com"
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$ ssh -T git@github.com #测试
The authenticity of host 'github.com (192.30.252.121)' can't be established.
RSA key fingerprint is SHA256:xxxx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.121' (RSA) to the list of known hosts.
Hi wenqy! You've successfully authenticated, but GitHub does not provide shell access.
xmn-wenqy@G-FJ-XMN-WQY MINGW64 ~
$
github上设置里新建ssh keys,将生成的pub公钥内容复制过去,然后测试是否可通
然后查看部署wenqy.github.io
当然,可以购买域名,然后绑定到github.io上吧。但这算告一段落了吧。Hexo使用markdown语法编写博客,轻量、快速。但估计我是被wordpress套牢了吧,主要还是这边捣捣东西了吧。
参考:
http://blog.fens.me/hexo-blog-github/ Hexo在github上构建免费的Web应用
本文由 wenqy 创作,采用 知识共享署名4.0
国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Nov 8,2020