Hello, today I will explain how to make a site on GitHub Pages easily in Archlinux.
NOTE: this article will be updated if the procedure changes.
First, you need Ruby. Install it with:
sudo pacman -Syu ruby gcc make git
Then you need Bundler. Install it after you have insalled Ruby.
gem install bundler
Creating a repository
Now, go to GitHub.
- In the upper-right corner of any page of GitHub, use the + drop-down menu, and select New repository.
- Type a name for your repository and an optional description. The username must match
<username>.github.io
, and are allowed only lowercase letters.
Creating the site
-
Open a terminal (QTerminal, Konsole, Gnome Terminal, etc.)
- You need to make a local copy of your repository.
$ mkdir <username>.github.io
- Enter the folder.
$ cd THE-FOLDER-YOU-CREATED
- Launch the command:
$ git init # Initialize the repository
- The site can be published in the
master
branch, but personally, it is better to use thegh-pages
branch. So, let’s create and checkout thegh-pages
branch.$ git checkout --orphan gh-pages
-
Now, install Jekyll. Unfortunately, Jekyll, if installed from “gem”, will not run on ArchLinux. Thus, we will install it from the AUR.
- After we installed Jekyll, we must create a new Jekyll site with the command:
$ jekyll new --skip-bundle .
-
Open the Gemfile that Jekyll created.
-
Add “#” to the beginning of the line that starts with
gem "jekyll"
to comment out this line. - Add the
github-pages
gem by editing the line starting with# gem "github-pages"
. Change this line to:gem "github-pages", "~> 228", group :jekyll_plugins
-
Save and close the Gemfile.
- from the command line, run
bundle install
- Optionally, make any necessary edits to the
_config.yml
file. This is required for relative paths when the repository is hosted in a subdirectory.domain: my-site.github.io - # if you want to force HTTPS, specify the domain without the http at the start, e.g. example.com url: https://my-site.github.io - # the base hostname and protocol for your site, e.g. http://example.com` baseurl: /REPOSITORY-NAME/ - # place folder name if the site is served in a subfolder
- Add and commit your work.
$ git add . $ git commit -m "Initial GitHub Pages site with Jekyll"
- Add your repository on GitHub.com as a remote, replacing USER with the account that owns the repository and REPOSITORY with the name of the repository.
$ git remote add origin git@github.com:USER/REPOSITORY.git
- Push the repository to GitHub.
$ git push -u origin gh-pages
Completed! Your site is now at https://<username>.github.io
.
See you soon for the guide on how to set up a theme for Jekyll. Bye!