# Understanding how to publish site via GitHub Pages

**URL:** <https://discourse.gohugo.io/t/understanding-how-to-publish-site-via-github-pages/38483>\
**Category:** support\
**Created:** [May 5, 2022, 9:17pm UTC](https://discourse.gohugo.io/t/understanding-how-to-publish-site-via-github-pages/38483 "2022-05-05T21:17:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EmilyGraceSeville7cf](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/emilygraceseville7cf/32/25909_2.png) [@EmilyGraceSeville7cf](https://discourse.gohugo.io/u/EmilyGraceSeville7cf)\
**Post date:** [May 5, 2022, 9:17pm UTC](https://discourse.gohugo.io/t/understanding-how-to-publish-site-via-github-pages/38483/1 "2022-05-05T21:17:20Z")

</div>

Hello! I have a [personal repo](https://github.com/EmilySeville7cfg/EmilySeville7cfg.github.io) and I want deploy this site.

cd.yml:

```auto
name: github pages

on:
  push:
    branches:
      - master # Set a branch to deploy
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'
          # extended: true

      - name: Build
        run: hugo --minify

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: github.ref == 'refs/heads/master'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public

```

config.yml:

```auto
baseURL: "https://emilyseville7cfg.github.io/"
languageCode: "en-us"
title: "Emily Grace Seville"
theme: "ananke"
ignoreFiles: ["^static/schemas/.*$"]
enableEmoji: true
markup:
  highlight:
    style: dracula
    lineNumbersInTable: false
cascade:
  featured_image: "/backgrounds/default.jpg"
  omit_header_text: true
Params:
  text_color: "purple"

```

What am I missing to successfully deploy my site? As I understand:

- site is being built to `public` folder
- this folder contents is pushed to `gh-pages`
- `gh-pages` is used to deploy site

Is it right? Why there is no `gh-pages` branch created after any new commit?

Now GitHub Actions fails with [`Action failed with "The process '/usr/bin/git' failed with exit code 128"`](https://github.com/EmilySeville7cfg/EmilySeville7cfg.github.io/runs/6313403957?check_suite_focus=true#step:5:106). 🤔

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/f/d/fdf958b2582a00afc62bfdd73d9ba0fdd89ccfac.png)

---

<div class="post-metadata">

**Author:** ![brilliantzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brilliantzen/32/16795_2.png) [@brilliantzen](https://discourse.gohugo.io/u/brilliantzen)\
**Post date:** [May 5, 2022, 10:48pm UTC](https://discourse.gohugo.io/t/understanding-how-to-publish-site-via-github-pages/38483/2 "2022-05-05T22:48:53Z")

</div>

Hey @EmilyGraceSeville7cf

It looks like you maybe publishing to the same branch.

I received similiar error and finally managed to publish my setup succesfully using a different branch to publish.  
Here are some things you can check…

My Github actions

```auto
name: CI
on: push
jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - name: Git checkout
        uses: actions/checkout@v2

      - name: Setup hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: "0.98.0"

      - name: Build
        # remove --minify tag if you do not need it
        # docs: https://gohugo.io/hugo-pipes/minification/
        run: hugo --minify

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          personal_token: ${{ secrets.TOKEN }}
          external_repository: YOUR GITHUB SITE LINK HERE
          publish_dir: ./public
          keep_files: true
          publish_branch: master

```

Obviously replace YOUR GITHUB SITE LINK HERE above.

> Head over to Repository Settings \> Environments \> Environment secrets \> Add a Secret… In my case I added a personal token with the name TOKEN. Your CI looks like it has a name GITHUB\_TOKEN. Make sure they match.

Note the publish\_branch is set to Master which is actually a different branch to my code. My code resides in “Main” branch. My site is published on “Master” branch.

> And finally Repository Settings \> Pages \> Set Source to Branch Master \> /Root`

Trigger another run for your actions and it should proceed.
