Skip to content

How to setup Hugo page in Gitlab

Attention

This page is not completed. Hugo is difficult for me…

Create Project in Gitlab

Command line instructions

You can also upload existing files from your computer using the instructions below.

Git global setup

git config --global user.name "yuichitamiya"
git config --global user.email "y2miyacatsfab@gmail.com"

Create a new repository

git clone git@gitlab.fabcloud.org:yuichitamiya/fa2023.git
cd fa2023
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main
Push an existing folder

cd existing_folder
git init --initial-branch=main
git remote add origin git@gitlab.fabcloud.org:yuichitamiya/fa2023.git
git add .
git commit -m "Initial commit"
git push -u origin main

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin git@gitlab.fabcloud.org:yuichitamiya/fa2023.git
git push -u origin --all
git push -u origin --tags

Remote to Gitlab

On Terminal

% cd repos
% hugo new site fa2023

% cd fa2023
% git init --initial-branch=main
% git remote add origin git@gitlab.fabcloud.org:yuichitamiya/fa2023.git
% git add .
% git commit -m "Initial commit"
% git push -u origin main

Create yml file


Edit toml file

copy page URL

Replace default into your page URL

Open your page

Add / Chage theme

On Terminal

% git pull
% git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke
% echo "theme = 'ananke'" >> config.toml

% git submodule add https://github.com/matcornic/hugo-theme-learn.git themes/learn
% atom .
Change theme

Local Web Server

% Hugo server -D
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

% git add .
% git commit -m "add theme learn"
% git push

Site


Last update: February 17, 2023