Starting from Scratch: Creating and Pushing Your Blog Posts with Hugo and Git

Build A Github Repository

ԅ(¯﹃¯ԅ)

Initialize

Create a Github repository and set the repository name.

Run the code in order in the PowerShell under the target directory:

1
2
3
4
5
6
cd dir_name
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/....
git push origin main

Hugo: Local Preview

Hugo comes with a built-in development server that allows you to preview the site in real time on the server:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cd D:/html
D:/hugo_extended/hugo server
    Watching for changes in D:\html\{archetypes,assets,content,data,i18n,layouts,static,themes}
    Watching for config changes in D:\html\hugo.yaml, D:\html\themes\hugo-theme-stack\config.yaml
    Start building sites …
    hugo v0.143.1-0270364a347b2ece97e0321782b21904db515ecc+extended windows/amd64 BuildDate=2025-02-04T08:57:38Z VendorInfo=gohugoio


                    | EN  
    -------------------+-----
    Pages            | 48  
    Paginator pages  |  2
    Non-page files   |  0
    Static files     | 13
    Processed images |  0
    Aliases          | 16
    Cleaned          |  0

    Built in 409 ms
    Environment: "development"
    Serving pages from disk
    Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
    Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
    Press Ctrl+C to stop

It supports for real-time revising and updating.

Hugo: Write A Post

New a post

( •̀ .̫ •́ )✧

Run the code in order in the PowerShell:

1
2
cd D:/html
D:/hugo_extended/hugo new post/fileName.md

Push to Github

(。・ω・。)ノ♡

Run the code in order in the PowerShell:

1
2
3
4
5
D:/hugo_extended/hugo
cd public
git add .
git commit -m "test"
git push origin main
Built with Hugo
Theme Stack designed by Jimmy