# Deploying to github

**URL:** <https://discourse.gohugo.io/t/deploying-to-github/50190>\
**Category:** support\
**Tags:** documentation\
**Created:** [June 7, 2024, 1:14am UTC](https://discourse.gohugo.io/t/deploying-to-github/50190 "2024-06-07T01:14:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![davaya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davaya/32/22276_2.png) [@davaya](https://discourse.gohugo.io/u/davaya)\
**Post date:** [June 7, 2024, 1:14am UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/1 "2024-06-07T01:14:24Z")

</div>

Following the quickstart instructions [Host on GitHub Pages | Hugo](https://gohugo.io/hosting-and-deployment/hosting-on-github/) the prerequisites say "create a Hugo site and test it locally with `hugo server`, which I did successfully.

But Step 1 and 2 say “create a GitHub repo” and “push your local repo to GitHub”. After creating a repo on GitHub and cloning it locally, the local repo has only README, LICENSE and .gitignore, so the create and test a Hugo site should come after cloning the local repo.

I did that, so the local repo now has .github/workflows/hugo.yaml and the whole “website/” folder that works properly with `hugo server`. But when I push to GitHub the action fails on the `Build with Hugo` step: “Error: Unable to locate config file or config directory. Perhaps you need to create a new site”

.github/workflows/hugo.yaml and website/hugo.toml are present. What other config file is the build action looking for?

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

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 7, 2024, 2:06am UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/2 "2024-06-07T02:06:00Z")

</div>

Your repo structure should look something like this:

[https://github.com/jmooring/hosting-github-pages](https://github.com/jmooring/hosting-github-pages)

Whether these files are present depends on how you built your site:

- go.mod
- go.sum
- package-lock.json
- package.json
- postcss.config.js

---

<div class="post-metadata">

**Author:** ![davaya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davaya/32/22276_2.png) [@davaya](https://discourse.gohugo.io/u/davaya)\
**Post date:** [June 7, 2024, 3:25am UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/3 "2024-06-07T03:25:07Z")

</div>

Thanks - that works. The quickstart instructions should be fixed to not create a quickstart directory in the local repo.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 7, 2024, 4:17am UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/4 "2024-06-07T04:17:34Z")

</div>

The documentation is fine.

If you followed the quick start guide you’ve already done a `git init` here:  
[https://gohugo.io/getting-started/quick-start/#create-a-site](https://gohugo.io/getting-started/quick-start/#create-a-site)

And when you create a repository on GitHub you are presented with these instructions:

![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/0/0/00fcd28d6c438a49af0a8060f230bdb1b0d26a4a.png)

There’s no need to clone anything.

---

<div class="post-metadata">

**Author:** ![davaya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davaya/32/22276_2.png) [@davaya](https://discourse.gohugo.io/u/davaya)\
**Post date:** [June 7, 2024, 12:23pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/5 "2024-06-07T12:23:01Z")

</div>

I did not and do not see those instructions anywhere on

- `https://gohugo.io/getting-started/quick-start/`,
- `the command line at git init`:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/e/b/ebb8b4a62f4f6eaab795bba19d78e3dfb2c09de2.png)
- `https://gohugo.io/hosting-and-deployment/hosting-on-github/`,
- `https://github.com/new`,
- or even `https://github.com/new/import`.

Yes, it is possible to push without pulling, but people can have used GitHub for years without ever doing so. In any case, it couldn’t hurt for the Hugo instructions to be explicit. This is a quckstart, and users of it can be expected to have varying levels of experience.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 7, 2024, 12:26pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/6 "2024-06-07T12:26:05Z")

</div>

> [@davaya](#):
>
> those instructions

Those instructions are displayed in your browser when you create a new repository on GitHub. We are not including them in our documentation.

---

<div class="post-metadata">

**Author:** ![davaya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davaya/32/22276_2.png) [@davaya](https://discourse.gohugo.io/u/davaya)\
**Post date:** [June 7, 2024, 12:28pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/7 "2024-06-07T12:28:14Z")

</div>

They are not.

I almost included the screenshot above, then deleted it. But here it is.

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

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 7, 2024, 12:33pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/8 "2024-06-07T12:33:37Z")

</div>

You need to click the “create repository” button to see the instructions.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [June 7, 2024, 12:41pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/9 "2024-06-07T12:41:15Z")

</div>

Maybe adding something like:

Use an existing repository for your hugo site:

```bash
git clone repopath/reponame
cd reponame
hugo new site . --force

```

And a hint what happens with duplicates

---

<div class="post-metadata">

**Author:** ![davaya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davaya/32/22276_2.png) [@davaya](https://discourse.gohugo.io/u/davaya)\
**Post date:** [June 7, 2024, 12:41pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/10 "2024-06-07T12:41:21Z")

</div>

They are not displayed if you create a README.

As an experienced software developer but new user of Hugo I believe others could be helped by a clue as simple as "Step one - create a GitHub repository (don’t check “Add a README file”). But this is your site, suit yourself.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 7, 2024, 12:45pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/11 "2024-06-07T12:45:08Z")

</div>

> [@irkode](#):
>
> Maybe adding something

Let’s revisit this when more than one person has a problem… these instructions have been in place for years.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 9, 2024, 12:46pm UTC](https://discourse.gohugo.io/t/deploying-to-github/50190/12 "2024-06-09T12:46:00Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
