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.
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:
$ 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.
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 username.github.io.
To generate the static pages, we can run the following command. The static pages are generated in a folder called static.
$ gssg --url https://username.github.io
Before pushing the static pages to Github, a repository called username.github.io 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 https://github.com/username/username.github.io.git
$ 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.