Octopress framework Github Pages are set up personal blog (on)

Transfer: https: //www.cnblogs.com/wanxudong/p/6772684.html

Octopress framework Github Pages are set up personal blog

First, prior knowledge:

1、shell command

2、Git

Second, the building process:

The following are specific installation steps (herein RVMinstallation, also by rbenvmounting, mounting official document Octopress analysis: Octopress the Setup ):

A view ruby ​​version

1
ruby --version  # 根据Octopress官方文档Ruby必须 >= 1.9.3-p0

 

 

If the version of ruby> = 1.9.3-p0skip RVM and Ruby installation.

Second, install RVM

1
curl -L https://get.rvm.io | bash -s stable --ruby

 

 

Third, install Ruby 1.9.3

1
2
3
rvm install 1.9.3 rvm use 1.9.3 rvm rubygems latest 

 

 

 

Fourth, the installation Octopress

1, the Octopress project cloneto local:

1
2
git clone git://github.com/imathis/octopress.git octopress
cd octopress

 

 

2, the update rubysource, the official will rubyreplace the source to domestic Taobao source.

1
2
3
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/ gem sources -l

 

 

 

3, dependent on the installation:

1
2
gem install bundler # 若遇权限问题加上sudo重新执行,并输入密码。
bundle install

 

 

4, the final installation Octopress

1
rake install       # 安装octopress默认主题

 

 5, the initial configuration modification Octopress

1
2
ls                 # 查看当前目录所有文件
vim _config.yml    # 通过vim编辑主要配置

 

 

image

Note: You can see the following code:

1
2
3
4
5
6 7 8 9 10 11 12 13 14 15 
# ----------------------- #
# Main Configs # # ----------------------- # #网站地址,这里是GitHub项目地址,为必填 url: http://userName.github.io #网站标题 title: user的博客 #网站副标题 subtitle: 天行健,君子以自强不息。 #网址作者 author: userName #搜索引擎 simple_search: https://www.google.com/search #网站的描述,出现在HTML页面中的 meta 中的 description description:

 

 

 

 

 

 

 

 

 

 

 

Ensure octopress directory, execute the command

1
2
rake generate  # 生成静态站点
rake preview   # 预览静态站点,在http://localhost:4000

 

 

 

Sixth, deployed to GitHub Pages

  Create an on GitHub New repository,Repository name that is the project name for the naming userName.github.io. userNameIt must match the user name. Tips:Best not to checkREADME , lest synchronized to the remote repository when the need to do additional pulloperations.

1, synchronized to the local code repository GitHub.

1
rake setup_github_pages

 

 

2, binding remote repository

1
git@github.com:your_username/your_username.github.io.git  # 或者https://github.com/your_username/your_username.github.io

 

 

3. Create an article

1
rake new_post["title"]

 

 

4, to generate a new article _posts / at source / directory

1
2
cd source/_posts   # 命令行cd到posts目录下
open ./ # 打开目录文件夹

 

 

   This time will see the directory .markdownfile suffix, we can through some third-party Markdown editor opens. Here is what I used Mou (Download: here ), Moucomes with real-time preview, also documented in the markdown syntax that is very detailed, not repeat them here.

5, after editing to generate a static site, the terminal execute the command:

1
rake generate     # 此命令需在octopress根目录执行,若当前目录为source/_posts,执行两次cd ..返回到根目录再执行此命令。

 

 

6, preview the local site, the implementation of directives:

1
rake preview

 

 

7, open a browser localhost:4000to view the web page effect effect. If the problem can not be a static site is synchronized to GitHuba remote warehouse in. Excuting an order

1
rake deploy      #同步到GitHub服务器

 

 

  Open GitHub wait a minute, we will see a static web page has been synchronized to the GitHub repository masterbranch on. Access browser access username.github.io, you will find a personal blog has been created successfully.

Finally, create sourcea branch. Octopress Git repository ( repository) has two branches, respectively, masterand source.

  • sourceBranch store is to generate blog's source file in the root directory octopress.
  • masterBranch storage contents of the blog site itself is the master, in the root directory _deployfolder, when you pushwhen the source file is ignored, it uses a rake deploycommand to update.
1
2
3
4
git checkout source
git add .
git commit -m "comment" #"comment"为提交的log日志 git push origin source

 

 

 

 

8, git operation code is as follows:

1
2
3
4
5
6 
git remote -v               # 显示所有远程仓库
git pull origin source      # 取回远程仓库的变化 git branch # 列出所有本地分支 git checkout [branch-name] # 切换到指定分支,并更新工作区 git merge [branch] # 合并指定分支到当前分支 git log # 查看当前分支的版本历史

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/yinminbo/p/11809693.html