win10+hexo+github搭建个人博客
2023-09-11 14:18:25 时间
win10+hexo+github搭建个人博客
Hexo+GitHub+Vercel搭建个人博客网站 直接安装,完成后,在cmd上输入node -v和npm -v查看是否安装成功,这两条命令如果都输出了版本号,那么就表示安装成功了
shaonbean To grow and to help others grow. To live and to help others live DevOps is everything!
参考:https://hexo.io/,博客用于记录自己的学习工作历程
参考以下步骤安装1、搭建环境准备(包括node.js和git环境,gitHub账户的配置)
2、安装 配置Hexo,配置将Hexo与github page结合起来
3、怎样发布文章 主题 推荐 主题
4、Net的简单配置 添加sitemap和feed插件
5、添加404 公益页面
win10+Node.js+git+github
Node.js下载地址:https://nodejs.org/en/download/ Git下载地址:https://git-scm.com/ Github 地址:https://github.com安装node.js 和 git 步骤省略,按默认傻瓜式安装即可
注册github账号并创建一个以 github昵称.github.io 命名的仓库根据图中,注册一个github账号,昵称自定义,然后创建一个新项目,名字为:github昵称.github.io
项目创建完成之后,本地生成ssh 私钥和公钥,用于连接github认证,使用上面下载的git,打开git bashssh-keygen -t rsa -C "github注册邮箱(自定义)" -f .ssh/shaonbean # -f 输出以昵称命名的公钥和私钥,方便记忆公钥生成之后加到github上,方便后面的使用,用户本地和github进行ssh通信
到这里github设置告一段落
安装配置hexo注:hexo安装前提需安装node.js 和git
hexo官网:https://hexo.io/ hexo官方文档:https://hexo.io/docs/文中以J盘为例,创建目录github并创建字目录(用于存放项目)
vdevops@shaon MINGW64 /j/github/shaonbean # 注: 如果是linux环境下搭建的hexo博客,不建议使用root权限下载安装hexo
npm install -g hexo-cli # 等待片刻,执行hexo如下图表示安装成功 hexo
这里以shaonbean为博客目录,执行下面命令
hexo init shaonbean # 创始化项目 cd shaonbean npm install测试本地建站是否成功,输入:
hexo s INFO Start processing INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop. # 出现上面两行,即表示本地建站成功初始化博客以后,能看到下图:
博客根目录初始化完成之后进项自定义配置,这里用到_config.yml
自定义博客的相关信息编辑_config.yml配置文件,进行修改,参考下面配置:
title: itdevops subtitle: DevOps is everything description: From Zero to the DevOps author: shaonbean language: zh-CN timezone: Asia/Shanghai # language和timezone 有规范,注意格式配置个人域名
url: http://vdevops.com
deploy: type: git repo: https://github.com/shaonbean/shaonbean.github.io.git branch: master
repo项是之前Github上创建好的仓库的地址
exec ssh-agent bash ssh-add MYKEY # 这里是针对本地设置多个github账号进行操作本地生成两对密钥对,然后在~/.ssh/目录下新建config文件,参考下面填入:
#————GitHub————— Host github HostName github.com User git PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa # github.io Host github.io HostName github.com User git PreferredAuthentications publickey IdentityFile ~/.ssh/itdevops测试本地ssh连接github是否正常
ssh -T git@github ssh -T git@github.io # 笔者这里第二个账号没设置成功,临时使用的https方式进行的通信使用https,github账号加密码的方式来进行hexo的部署。配置如下:
deploy: type: git #repo: git@github.io:shaonbean/shaonbean.github.io.git repo: https://shaonbean:shaonbeanpassword@github.com/shaonbean/shaonbean.github.io.git branch: master message: devops配置完成之后,现在可以进到设置的项目目录里面通过hexo部署到github
进到你的项目目录。命令行执行下面命令:
hexo g # 本地生成数据库文件,目录等 hexo d # 部署到远程新建一篇博客
hexo new post "devops"
然后通过电脑编辑器(atom)对文章进行编辑,编辑完成之后,再次运行上面的生成,部署命令
hexo g # 本地生成博客 hexo d # 发布到远程 hexo d -g #在部署前先生成
注: 安装git扩展
npm install hexo-deployer-git --save # 没安装插件可能报错:deloyer not found:gitssh key报错
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上面shaonbean.github.io,已经存在文件,通过浏览器访问如下:从上面可以看出我们已经成功部署到远程,并能够正常访问。
配置博客主题选择NexT,star最多,原因不多说
知乎主题推荐:https://www.zhihu.com/question/24422335
cd /j/github/shaonbean.github.io # 这里项目名可以自定义 git clone https://github.com/iissnan/hexo-theme-next themes/next更换主题完成后,访问:
推送DevOps最新资讯及技术文章
Hexo+GitHub+Vercel搭建个人博客网站 直接安装,完成后,在cmd上输入node -v和npm -v查看是否安装成功,这两条命令如果都输出了版本号,那么就表示安装成功了
shaonbean To grow and to help others grow. To live and to help others live DevOps is everything!
相关文章
- hexo + github 搭建个人博客
- Github博客私人订制(一)
- git上传本地项目到github
- When using 'npm' it requires me to login to github
- GitHub如何在自己的Stars中进行搜索
- 在Github上搭建博客
- github上fork别人的代码之后,如何保持和原作者同步的更新
- 使用site-maven-plugin在github上搭建公有仓库
- GitHub Desktop Git
- 用code作为博客托管并且避免github ssh覆盖
- 使用Hexo在Github上搭建自己的博客
- hexo + Github Page 0元建立博客攻略
- 博客Hexo + github pages + 阿里云绑定域名搭建个人博客
- 用git命令行将本地代码上传到github上
- Hexo + github 打造个人博客
- 通过修改hosts解决gist.github.com无法访问的问题
- 【Jekyll】使用GitHub Pages + Jekyll搭建自己的技术博客,Jekyll服务器的搭建
- git 上传项目到github
- Github 树形菜单插件
- Github注册教程
- 使用GitHub.io当作自己的博客网站
- 使用GitHub.io当作自己的博客网站
- linux下git和github搭建使用教程
- 内网服务暴露到外网,实现内网穿透(外网访问内网服务器),自动化配置和部署方案之frp,附实现源码,相关资源放到 GitHub 上免费下载
- GitHub项目管理基本操作
- 下载 github 项目文件到本地方法