DEV Community

Posted on • Originally published at on

Blogging with Hugo and GitLab (2): Local Development Setup

While you can edit pages online in GitLab (e.g., through Web IDE, which also allows to preview Markdown pages), a local development environment of Hugo provides the best support of "what you see is what you get".


  • macOS Sierra 10.12.6.
  • Hugo v0.54.0.

Create a local repository

With the website repository hosted on GitLab, we can clone the repository to local.

  1. Clone your website repository to local.
git clone
  1. Configure your GitLab account email within the local repository, which will be used as the identification for all change commit.
git config ""

The updated account information can be verified in .git/config:

email =

Install Hugo to local

  1. Install Homebrew in macOS.
/usr/bin/ruby -e "$(curl -fsSL"
  1. Install Hugo.
brew install hugo

Verify the installation by viewing the Hugo version:

hugo version

Start the Hugo server

Start the Hugo server with "drafts" enabled, which will show all pages including drafts on the local server.

hugo server -D

Now you will be able to view your website locally at: http://localhost:1313.

The Hugo server will keep running until you press Ctrl+C to stop it. Any saved changes will be immediately reloaded.

Discussion (0)