Hosting the Ghost blog on GitHub

Install Ghost locally

GitHub Pages is a great solution for hosting static website. If you use the Ghost to manage your website, you can install Ghost locally and convert it to a static website in order to host it on Github.

Install Ubuntu virtual machine on Windows(optional)

Install Ghost-CLI

Ghost-CLI is a commandline tool to help you get Ghost installed and configured for use, quickly and easily.

$ npm install ghost-cli@latest -g

Ghost runs as background process and remains running until you stop or restart it. The following are some useful commands:

ghost help
ghost ls
ghost log
ghost stop
ghost start

Install Ghost

$ mkdir my-ghost-website
$ cd my-ghost-website
$ ghost install local

Once the Ghost is installed you can access the website on http://localhost:2368/ghost for Ghost Admin.

Generate the static website

In order to generate the static website, we’ll use the Ghost static site generator. For the Linux and macOS, this tool can be used directly.

$ sudo npm install -g ghost-static-site-generator

Now, we can push the generated static pages to the Github repository named

To generate the static pages, we can run the following command. The static pages are generated in a folder called static.

$ gssg --url

Push the static pages to Github

Before pushing the static pages to Github, a repository called should be created on Github website.

The static pages can be pushed to Github repository as below.

$ cd static
$ git init .
$ git remote add origin
$ git branch -M main
$ git add .
$ git commit -m 'Init my website'
$ git push -u origin main

After the push, Github will build and deploy the pages automatically. And the updated website will be available to access in a few minutes.