您好,登錄后才能下訂單哦!
首先在終端查看是否安裝了git,如果出現(xiàn)以下信息說(shuō)明安裝了git,請(qǐng)?zhí)^(guò)這一步
$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
如果沒(méi)有安裝,則通過(guò)homebrew安裝
$ brew install git
如果沒(méi)有安裝homebrew,請(qǐng)先安裝homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝node.js
$ brew install node
去git官網(wǎng)下載然后按提示安裝即可
去node.js官網(wǎng)下載然后根據(jù)提示安裝即可
在git和node.js都安裝成功后就可以開(kāi)始安裝hexo了
安裝hexo
$ npm install -g hexo
初始化hexo,建一個(gè)你自己博客的文件夾,例如MyBloc,然后進(jìn)入文件夾,執(zhí)行
hexo init
生成靜態(tài)文件
$ hexo generate
啟動(dòng)服務(wù)器
$ hexo server
默認(rèn)情況下,訪問(wèn)網(wǎng)址為: http://localhost:4000/
然后你在瀏覽器打開(kāi)后就可以看到本地博客了
然后你可以去官方文檔去查看更多的指令
首先新建一個(gè)倉(cāng)庫(kù)
注意倉(cāng)庫(kù)的名字必須是username.github.io,username替換為你自己賬號(hào)的名字
首先查看是不是已經(jīng)有了ssh秘鑰,如果能看到這三個(gè)文件說(shuō)明已經(jīng)有了,跳過(guò)生成秘鑰的過(guò)程
$ cd ~/.ssh
$ ls
id_rsa id_rsa.pub known_hosts
如果沒(méi)有秘鑰,那么首先來(lái)生成秘鑰,換成你自己的郵箱地址
ssh-keygen -t rsa -C "your email"
然后會(huì)在~/.ssh下生成id_rsa和id_rsa.pub文件
然后拷貝id_rsa.pub文件里的內(nèi)容,添加到你的GitHub上
打開(kāi)你博客文件夾根目錄下的_config.yml文件,然后添加入下內(nèi)容,將username改為你自己的賬號(hào)名
deploy:
type: git
repo: git@github.com:username/username.github.io
branch: master
安裝自動(dòng)發(fā)布工具
$ npm install hexo-deployer-git --save
然后部署到GitHub
$ hexo clean //清理
$ hexo generate //生成靜態(tài)文件
$ hexo deploy //部署網(wǎng)站
然后你打開(kāi) https://username.github.io就可以看到你自己的博客了
新建博客
$ hexo new "文章標(biāo)題"
然后就會(huì)在博客根目錄的source/_posts/下看到"文章標(biāo)題.md",你就可以開(kāi)始編輯你的文章了。
后續(xù)會(huì)出給你的博客更換主題、添加評(píng)論等,敬請(qǐng)期待!
歡迎關(guān)注公眾號(hào)
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。