您好,登錄后才能下訂單哦!
首先在終端查看是否安裝了git,如果出現以下信息說明安裝了git,請跳過這一步
$ 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.
如果沒有安裝,則通過homebrew安裝
$ brew install git
如果沒有安裝homebrew,請先安裝homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝node.js
$ brew install node
去git官網下載然后按提示安裝即可
去node.js官網下載然后根據提示安裝即可
在git和node.js都安裝成功后就可以開始安裝hexo了
安裝hexo
$ npm install -g hexo
初始化hexo,建一個你自己博客的文件夾,例如MyBloc,然后進入文件夾,執行
hexo init
生成靜態文件
$ hexo generate
啟動服務器
$ hexo server
默認情況下,訪問網址為: http://localhost:4000/
然后你在瀏覽器打開后就可以看到本地博客了
然后你可以去官方文檔去查看更多的指令
首先新建一個倉庫
注意倉庫的名字必須是username.github.io,username替換為你自己賬號的名字
首先查看是不是已經有了ssh秘鑰,如果能看到這三個文件說明已經有了,跳過生成秘鑰的過程
$ cd ~/.ssh
$ ls
id_rsa id_rsa.pub known_hosts
如果沒有秘鑰,那么首先來生成秘鑰,換成你自己的郵箱地址
ssh-keygen -t rsa -C "your email"
然后會在~/.ssh下生成id_rsa和id_rsa.pub文件
然后拷貝id_rsa.pub文件里的內容,添加到你的GitHub上
打開你博客文件夾根目錄下的_config.yml文件,然后添加入下內容,將username改為你自己的賬號名
deploy:
type: git
repo: git@github.com:username/username.github.io
branch: master
安裝自動發布工具
$ npm install hexo-deployer-git --save
然后部署到GitHub
$ hexo clean //清理
$ hexo generate //生成靜態文件
$ hexo deploy //部署網站
然后你打開 https://username.github.io就可以看到你自己的博客了
新建博客
$ hexo new "文章標題"
然后就會在博客根目錄的source/_posts/下看到"文章標題.md",你就可以開始編輯你的文章了。
后續會出給你的博客更換主題、添加評論等,敬請期待!
歡迎關注公眾號
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。