如何在github创建个人博客?
来源:互联网 发布:书店管理系统完整源码 编辑:程序博客网 时间:2024/06/10 12:08
文章来自于hifor的博客
如何在github创建个人博客?
- 如何在github创建个人博客
- git和nodejs的安装就不解释了
- 申请github账号是程序员应该都有一个吧不解释
- 创建github仓库
- 安装hexohexo是基于nodejs的
- 本地支行hexo
- 管理博客
- 发一篇新的博客
- 发布博客
git和node.js的安装就不解释了
#查看安装是否成功git --versionnode -vnpm -v
申请github账号(是程序员应该都有一个吧,不解释)
创建github仓库
因为我已经创建过了,所以会报错,仓库命名一定要严格按“zengmianhui.github.io”来命名,”zengmianhui”是你的用户名
这样创建成功后就可以直接访问了
安装hexo(hexo是基于node.js的)
在hifor的博客中,在安装hexo之前,有先设置淘宝的镜像来安装hexo的,但是我实际安装是不需要的,网速还可以。
使用以下代码安装hexo
$ npm install -g hexo-cli
出现的WARN可以不用理会
继续使用命令
npm install hexo --save
查看hexo是否安装正确
hexo -v
本地支行hexo
初始化hexo
hexo init
安装生成器
npm install
在本地运行hexo
hexo s -g
打开浏览器,输入localhost:4000,就可以在本地看到你的个人博客了,按住Ctrl+C键即可停止
管理博客
打开根目录下的_config.yml,注意:主题目录下也有 _config.yml
# Hexo Configuration## Docs: https://hexo.io/docs/configuration.html## Source: https://github.com/hexojs/hexo/# Sitetitle: zengmianhui's personal blogsubtitle:description: 来这里,查看更多技术的分享author: zengmianhuilanguage: zh-Hans#时区timezone:# URL## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'url: https://zengmianhui.github.ioroot: /permalink: :year/:month/:day/:title/permalink_defaults:# Directorysource_dir: sourcepublic_dir: publictag_dir: tagsarchive_dir: archivescategory_dir: categoriescode_dir: downloads/codei18n_dir: :langskip_render:# Writingnew_post_name: :title.md # File name of new postsdefault_layout: posttitlecase: false # Transform title into titlecaseexternal_link: true # Open external links in new tabfilename_case: 0render_drafts: falsepost_asset_folder: falserelative_link: falsefuture: truehighlight: enable: true line_number: true auto_detect: false tab_replace:# Category & Tagdefault_category: categorizedcategory_map:tag_map:# Date / Time format## Hexo uses Moment.js to parse and display date## You can customize the date format as defined in## http://momentjs.com/docs/#/displaying/format/date_format: YYYY-MM-DDtime_format: HH:mm:ss# Pagination## Set per_page to 0 to disable paginationper_page: 10pagination_dir: page#博客主题# Extensions## Plugins: https://hexo.io/plugins/## Themes: https://hexo.io/themes/theme: next#发布设置# Deployment## Docs: https://hexo.io/docs/deployment.htmldeploy: type: git repo: https://github.com/zengmianhui/zengmianhui.github.io.git branch: master message: 我的博客#头像avatar: zengmianhui.github.io/images/avatar.jpg
发一篇新的博客
输入命令
$ hexo new "博客名"
打开生成的博客,并编辑
---title: 如何在github上创建个人博客?date: 2017-01-27 01:13:43categories: - 其他 - githubtags: - 其他---摘要:<!--more-->正文:
发布博客
当然发布之前,首先要确保你本地的SSH和github上保存的SSH是一致的
如果电脑中没有SSH,就输入以下命令生成
$ ssh-keygen -t rsa -C "邮件地址@youremail.com"Generating public/private rsa key pair.Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):<直接回车>
注意1: 此处的邮箱地址,你可以输入自己的邮箱地址;
注意2: 此处的「-C」的是大写的「C」
然后系统会要你输入密码:
Enter passphrase (empty for no passphrase):<输入加密串>Enter same passphrase again:<再次输入加密串>
在回车中会提示你输入一个密码,这个密码会在你提交项目时使用,如果为空的话提交项目时则不用输入。这个设置是防止别人往你的项目里提交内容。
添加SSH Key到GitHub
在本机设置SSH Key之后,需要添加到GitHub上,以完成SSH链接的设置。
1、打开本地C:\Documents and Settings\Administrator.ssh\id_rsa.pub文件。此文件里面内容为刚才生成人密钥。如果看不到这个文件,你需要设置显示隐藏文件。准确的复制这个文件的内容,才能保证设置的成功。
2、登陆github系统。点击右上角的 Account Settings—>SSH Public keys —> add another public keys
3、把你本地生成的密钥复制到里面(key文本框中), 点击 add key 就ok了
设置git信息
2$ git config --global user.name "你的用户名"$ git config --global user.email "你的邮箱"
安装hexo git插件,这个插件会自动push到github
$ npm install hexo-deployer-git --save
使用命令,hexo会自动将博客push到github上
$ hexo d -g
发布时需要输入github的帐号和密码,输入密码时是看不到自己输入的内容的
发布成功后,访问yourname.github.io看下成果
我的个人博客
- 如何在github创建个人博客?
- github pages帮助如何创建个人博客
- 如何在github上搭建个人博客
- Hexo+GitHub创建个人博客
- 在github上创建个人博客,其实没有那么难
- 如何创建github博客
- 如何在Github搭建自己的个人博客
- github创建个人博客及自定义域名
- Git Github Jekyll创建个人博客
- 用github + jekyll创建个人博客
- hexo+github创建个人博客--基础篇
- hexo+github创建个人博客--深入篇
- 如何利用github创建博客
- 如何设置Github个人技术博客
- 如何使用hexo+github配置个人博客
- 如何拥有个人的Github技术博客
- Jekyll&&Github---使用jekyll在github上面搭建个人博客
- 在GitHub上创建博客主页
- Android上的WebView和ScrollView1起使用
- react-router
- python创建TCP客户端
- 编译极路由(HC5x61)固件
- 如何指定listview的某item滚动到在第一行
- 如何在github创建个人博客?
- 关于导入jar包和作为library引用的区别解释
- 九度OJ-1153-括号匹配问题
- 优化SimpleAdapter适配器加载效率
- 算法与数据结构
- 题目1031:xxx定律
- leveldb源码分析--SSTable之block
- Codefroces 750C New Year and Rating
- python字典破解