Hexo: Working with Hexo on different PC's with Git

Created on 21 Jun 2017  ·  4Comments  ·  Source: hexojs/hexo

Environment Info

Node version(node -v):
v4.7.2
Your site _config.yml (Optional):

Your theme _config.yml (Optional):

Hexo and Plugin version(npm ls --depth 0):
[email protected] /home/wojcieh/hexo-fwtc
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

For question


Hello,
On one PC (Ubuntu) I am working on Hexo blog. I push the blog files to Bitbucket Git.
On the second PC (Ubuntu) I would like to clone existing Bitbucket repository and continue work on the second PC.

I tried the following:

  • hexo init blog (works fine)
  • hexo server (works fine)
  • copy cloned repository to blog directory
  • hexo server

I used the same tutorial to install hexo. On first PC I just added one theme to hexo base installation.

This is the content from first PC (so this is git version of hexo blog):

  • config.yml
  • .git
  • .gitignore
  • package.json
  • scaffolds
  • source
  • themes

This is the content of the second PC:

  • _config.yml
  • db.json
  • .gitignore
  • node_modules
  • package.json
  • scaffolds
  • source
  • themes

What I am doing is to delete all files and folders from the second PC besides node_modules
As you may expect hexo server fails.

ERROR Script load failed: themes/tranquilpeak/scripts/migrators/1.4.0.js
Error: Cannot find module 'prompt'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (/home/wojcieh/hexo-fwtc/node_modules/hexo/lib/hexo/index.js:216:21)
    at /home/wojcieh/hexo-fwtc/themes/tranquilpeak/scripts/migrators/1.4.0.js:7:16
    at /home/wojcieh/hexo-fwtc/themes/tranquilpeak/scripts/migrators/1.4.0.js:233:3
    at /home/wojcieh/hexo-fwtc/node_modules/hexo/lib/hexo/index.js:232:12
    at tryCatcher (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/promise.js:638:18)
    at /home/wojcieh/hexo-fwtc/node_modules/bluebird/js/release/nodeback.js:42:21
    at /home/wojcieh/hexo-fwtc/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
module.js:327
    throw err;
    ^

Error: Cannot find module 'jquery'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (/home/wojcieh/hexo-fwtc/node_modules/hexo/lib/hexo/index.js:216:21)
    at Object.done (/home/wojcieh/hexo-fwtc/themes/tranquilpeak/scripts/tags/tabbed_codeblock.js:18:11)
    at /home/wojcieh/hexo-fwtc/node_modules/jsdom/lib/jsdom.js:271:18
    at nextTickCallbackWith0Args (node.js:436:9)
    at process._tickCallback (node.js:365:13)

Most helpful comment

@wojciehm

It is recommended to make git with hexo and each theme. And for sharing data it's better to use online storage like Dropbox.

File

Dropbox:

myTheme.git
myHexoBlog.git

First PC:

  • config.yml
  • .git (git remote add origin your-Dropbox-dir/myHexoBlog.git)
  • .gitignore
  • package.json
  • scaffolds
  • source
  • themes

    • myTheme (e.q. tranquilpeak)



      • .git (git remote add origin your-Dropbox-dir/myTheme.git)


      • .gitignore


      • _config.yml


      • README.md


      • layout


      • scripts


      • source


      • (bower.json)


      • (.bowerrc)



Second PC:

(Same file as First PC)

Comands

Dropbox :

$ cd your-Dropbox-dir
$ mkdir myHexoBlog.git
$ cd myHexoBlog.git
$ git init --bare --shared=true
$ cd ../
$ mkdir myTheme.git
$ cd myTheme.git
$ git init --bare --shared=true

First PC (Dropbox installed PC):

$ cd your-hexo-blog-dir
$ git init
$ git romote add origin git remote add origin your-Dropbox-dir/myHexoBlog.git
$ git add .
$ git commit -m "first commit"
$ git push origin master
$ cd themes/mytheme
$ git init
$ git remote add origin your-Dropbox-dir/myTheme.git
$ git add .
$ git commit -m "first commit"
$ git push origin master

Second PC (Dropbox installed PC):

$ git clone your-Dropbox-dir/myHexoBlog.git
$ cd themes
$ git clone your-Dropbox-dir/myTheme.git
$ bower install
$ cd ../
$ npm install

If you use tranquilpeak as a theme, you may need to bower install.

  • fontawesome
  • jquery
  • fancybox

https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak/blob/master/bower.json

All 4 comments

after clone the blog repository, run npm install to install the dependencies.

@wojciehm

It is recommended to make git with hexo and each theme. And for sharing data it's better to use online storage like Dropbox.

File

Dropbox:

myTheme.git
myHexoBlog.git

First PC:

  • config.yml
  • .git (git remote add origin your-Dropbox-dir/myHexoBlog.git)
  • .gitignore
  • package.json
  • scaffolds
  • source
  • themes

    • myTheme (e.q. tranquilpeak)



      • .git (git remote add origin your-Dropbox-dir/myTheme.git)


      • .gitignore


      • _config.yml


      • README.md


      • layout


      • scripts


      • source


      • (bower.json)


      • (.bowerrc)



Second PC:

(Same file as First PC)

Comands

Dropbox :

$ cd your-Dropbox-dir
$ mkdir myHexoBlog.git
$ cd myHexoBlog.git
$ git init --bare --shared=true
$ cd ../
$ mkdir myTheme.git
$ cd myTheme.git
$ git init --bare --shared=true

First PC (Dropbox installed PC):

$ cd your-hexo-blog-dir
$ git init
$ git romote add origin git remote add origin your-Dropbox-dir/myHexoBlog.git
$ git add .
$ git commit -m "first commit"
$ git push origin master
$ cd themes/mytheme
$ git init
$ git remote add origin your-Dropbox-dir/myTheme.git
$ git add .
$ git commit -m "first commit"
$ git push origin master

Second PC (Dropbox installed PC):

$ git clone your-Dropbox-dir/myHexoBlog.git
$ cd themes
$ git clone your-Dropbox-dir/myTheme.git
$ bower install
$ cd ../
$ npm install

If you use tranquilpeak as a theme, you may need to bower install.

  • fontawesome
  • jquery
  • fancybox

https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak/blob/master/bower.json

@tea3
Thanks for such detailed explanation. I will test it immediately and let you know.

@wojciehm
You're welcome : ) if you have no problem please close this issue .

Was this page helpful?
0 / 5 - 0 ratings