Hexo git to different computer

Hexo git to different computer

create a clean local hexo blog directory

install hexo first !

1
npm install hexo-cli -g

Initialize hexo folder

1
2
# hexo init FOLDER_NAME
hexo init hexolocal

Change “_config.yml”

1
2
3
4
5
6
7
url: https://username.github.io/
...

deploy:
type: git
repo: https://github.com/username/username.github.io
branch: master

Generate

1
2
3
4
5
# under hexo folder
hexo g

# view on the loclal
hexo s

Pull the Blog page repo & copy the local hexo files to a different working branch

1
2
3
git clone git@github.com:Pyrad/Pyrad.github.io.git
cd Pyrad.github.io
git pull

Create a new branch for hexo folder

1
2
3
4
# Create a new branch: hexo
git branch hexo
# Change to the new hexo branch for working !!!
git checkout hexo

Clean the branch

1
git rm -rf .

Copy all files inside the previous hexo folder here

1
2
3
4
5
6
7
8
9
10
11
12
cp -rf /path/to/hexolocal/.github .
cp -rf /path/to/hexolocal/scaffolds/ .
cp -rf /path/to/hexolocal/source/ .
cp -rf /path/to/hexolocal/themes/ .
cp -rf /path/to/hexolocal/.gitignore/ .
cp -rf /path/to/hexolocal/_config.*/ .
cp -rf /path/to/hexolocal/package.json/ .
cp -rf /path/to/hexolocal/package-lock.json/ .

git add .
git commit -m "create hexo branch for blog source files; Use this as the default working branch for blogging"
git push ### Should set up the upstream first

Regenerate the hexo file modules

1
2
cnpm install
cnpm install hexo-deployer-git --save

Try hexo

1
2
3
hexo -v
hexo g
hexo s
Author

Pyrad Selong

Posted on

2021-07-19

Updated on

2022-04-17

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.