synchronize the hexo with github


Recently I move my blog from vps to github with hexo.It’s first time to use hexo.It’s good but I have a question with how to deal with write my blog in different computer.The code of hexo to deploy in github is not with the source code.With the google,I found a really method.
In baidu,all method is say to create a branch to save the code.I don’t like it.I want to create a private repository.

Let’s go!

BACK_UP

create a private repository in github

nothing to say.

create a local repository

go to you blog folder,delete all gits of themes.

rm -rf ./themes/*/.git/

create a local git repository

git init

create a file named .gitignore,put it in the root of blog.content is

.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/

than create a file name CNAME in source,content is your domain.

push it to your private repository

git remote add origin https://github.com/<yourname>/myblog.git
git add .
git commit -m "myblog"
git push -u origin master

all the backup is over

write in other computer

build the environment

install node.js and git

install hexo

create folder name hexo and go to it

npm install -g hexo

pull your blog

git clone https://github.com/<yourname>/myblog.git

write a new article

init the hexo environment
WARRING!!! DON’T USE hexo init,because the hexo init will rewrite your blog.
USE:

npm install

the create a new article

hexo new "test"

push it to github and publish

publish it to hexo

hexo clean
hexo g
hexo s
hexo d

push it to github

git status
git add .
git commit
git push

update the hexo

exec these commands to update the hexo

git fetch -all # pull all files from github to locat
git reset --hard origin/master #Force local content to just sync git cloud content

the reason for don’t use pull is there are many files in local.Reset does nothing to the file being pulled.Use pull may take some mistake because of the target.

END!
ENjoy the github!


文章作者: xyzz
文章链接: http://www.xyzzpwn.top
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 xyzz !
 上一篇
cve-2018-1111 cve-2018-1111
Recently, Red Hat has released a security update that fixes a remote code execution flaw numbered CVE-2018-1111. An atta
2018-05-20
下一篇 
Flow meter Flow meter
All is build in Raspberry Pi 3b this is a bash for Raspberry Pi to get a gpio python php mysql and open i2c-0 pi.sh #su
2018-05-19
  目录