檢查ssh公鑰設置:git
若是id_rsa*文件不存在,跳到第三步;github
$ cd .ssh $ ls
備份原來的ssh key:web
備份舊數據,備份後刪除舊數據;ruby
$ mkdir key_backup $ cp id_rsa* key_backup $ rm id_rsa*
生成github ssh key:markdown
$ ssh-keygen -t rsa -C "id@youremail.com" <github 賬號> Generating public/private rsa key pair. Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):<回車就好>
而後系統會要你輸入加密串併發
Enter passphrase (empty for no passphrase):<github密碼> Enter same passphrase again:<再次輸入密碼>
最後看到下面信息就成功了dom
Your identification has been saved in /Users/xxx/.ssh/id_rsa. Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub. The key fingerprint is: ac:63:ff:c9:67:8f:c7:b7:26:43:77:83:bd:ef:11:be username@gmail.com The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | . | | S .| | . ..| | + .o..| | . o . .o*o==| | ..+ooo*EO| +-----------------+
添加ssh key到github:ssh
複製id_rsa.pub的內容到github Account Settings
-> SSH Keys
-> add SSH Key
-> Key
編輯器
在你本地安裝octopresside
$ git clone git://github.com/imathis/octopress.git octopress $ cd octopress # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes). $ ruby --version # Should report Ruby 1.9.2 $ gem install bundler # Install dependencies $ bundle install $ rake install # Install the default Octopress theme
配置你本地的octopress
建立github repo,名稱username.github.com
配置octopress使之與username.github.com
關聯
$ cd octopress $ rake setup_github_pages Enter the read/write url for your repository (For example, 'git@github.com:your_username/your_username.github.com') Repository url: <git@github.com:yourname/yourname.github.com>
以上執行後會要求 read/write url for repository : git@github.com:yourname/yourname.github.com.git
初始化github
$ rake generate $ rake deploy
等待幾分鐘後,github上會收到一封信:「[yourname.github.com] Page build successful」,第一次發佈後等比較久,以後每次都會直接更新
將 source 也加入 git
$ cd octopress $ git add . $ git commit -m 'your message' $ git push origin source
更新 Octopress
往後有 Octopress 新版本發佈,使用如下指令升級。
$ git pull octopress master # Get the latest Octopress $ bundle install # Keep gems updated $ rake update_source # update the template's source $ rake update_style # update the template's style
編寫併發布文章
發表新文章:
$ rake new_post["文章名稱"]
該命令會在你的」octopress/source/_posts」目錄下生成對應的」.markdown」文件,用任意文本編輯器編輯,使用markdown語法編寫你的文章。
生成:
$ rake generate # generate your blog static pages content according to your input.
預覽:
$ rake preview # start a web server on "http://localhost:4000", you can preview your blog content.
發佈:
$ rake deploy # push your static pages content to your github pages repo ("master" branch)
生成併發布:
$ rake gen_deploy