创建github 账户
git 基础知识
# 初始git 项目
git init
# 添加项目
git add . # .表示所有 也可以指定文件添加
# 添加提交说明
git commit -m'' # '' 加入说明介绍
# 提交 代码
git push # 如果第一次 可能会提示 git push --set-upstream origin master
使用 主题工具
点击 use this template
选择 Create a new repository 创建属于自己的 github pages
打开自己创建的项目
点击 code 选择 code spaces
下载 hugo
信息
修改 github workflows 文件
- deploy.yml
name: Deploy to Github Pages
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache Hugo resources
uses: actions/cache@v2
env:
cache-name: cache-hugo-resources
with:
path: resources
key: ${{ env.cache-name }}
- uses: actions/setup-go@v2
with:
go-version: "^1.17.0"
- run: go version
- name: Cache Go Modules
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.111.3"
extended: true
- name: Build
run: hugo --minify --gc
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.2
with:
branch: gh-pages
folder: public
clean: true
single-commit: true
- 变更 hugo-version: "latest" ==> hugo-version: "0.111.3"
设置 项目 settings
- 点击 Actions
- 选择 General
- 选择
Workflow permissions
- 选择
Read and write permissions
创建新的页面
hugo new post/2023/05/31/new.md
信息
需要改 文件头
---
title: "Hugo"
description:
date: 2023-05-31T08:42:48Z
image:
math:
license:
hidden: false
comments: true
draft: true
---
需要将 draft
: true
删除
提交对应代码
命令行提交
git add .
git commit -m'test'
git push