# Hugo Site works beautifully in my local server but is broken when publishing to Github

**URL:** <https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588>\
**Category:** support\
**Created:** [August 2, 2023, 4:55pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588 "2023-08-02T16:55:37Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 4:55pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/1 "2023-08-02T16:55:37Z")

</div>

I’m new to Hugo. I’m just trying to create a website for my portfolio and can’t seem to get it down. I followed the Hugo Quickstart guide to make a website in Ananke and spent hours learning how to do it. However no matter what I do the website is fundamentally broken whenever I publish it to Github Pages. I’ve tried so many different things, even deleted the whole thing and recreated it again in a new, cleaner directory. Tried using docs instead of public, changed the URL to match, etc. None of it works. I’m at a loss here. Not sure what code to post but [here’s](https://github.com/pcm19b/PortfolioSite) the repo. I don’t know what to do, please help.

 ![Screen Shot 2023-08-02 at 1.00.31 PM](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/2/8/28657c858a7570ab717b9d01dce99341b4cd6021.png)

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:02pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/2 "2023-08-02T17:02:23Z")

</div>

![Screen Shot 2023-08-02 at 1.00.24 PM](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/8/c/8ca49672815df41686a7d98b560c87eede121393.png)

this is what it looks like when published on GitHub pages.

---

<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:** [August 2, 2023, 5:07pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/3 "2023-08-02T17:07:29Z")

</div>

Your repo contains the published site, not your source code.

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:08pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/4 "2023-08-02T17:08:23Z")

</div>

apologies, what files would be required then?

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:08pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/5 "2023-08-02T17:08:54Z")

</div>

the markdown files?

---

<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:** [August 2, 2023, 5:12pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/6 "2023-08-02T17:12:40Z")

</div>

The whole project. Something like:

```plaintext
my-project-directory/
├── archetypes/
│ └── default.md
├── assets/
├── content/
│ ├── posts/
│ │ └── post-1.md
│ └── _index.md
├── layouts/
│ ├── _default/
│ │ ├── baseof.html
│ │ ├── home.html
│ │ ├── list.html
│ │ └── single.html
│ ├── partials/
│ └── shortcodes/
├── static/
│ └── favicon.ico
├── LICENSE
├── README.md
└── hugo.toml

```

---

<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:** [August 2, 2023, 5:17pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/7 "2023-08-02T17:17:07Z")

</div>

But don’t include the top level directory. Example:  
[https://github.com/jmooring/hugo-testing/tree/scaffold](https://github.com/jmooring/hugo-testing/tree/scaffold)

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:24pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/8 "2023-08-02T17:24:24Z")

</div>

> **[GitHub - pcm19b/sigh: sigh](https://github.com/pcm19b/sigh)**
>
> sigh. Contribute to pcm19b/sigh development by creating an account on GitHub.

it wouldn’t let me upload the themes directory as it has over 100 files and it wouldn’t take it. however, all I have in there is ananke that I got from following the Quickstart guide.

---

<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:** [August 2, 2023, 5:26pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/9 "2023-08-02T17:26:39Z")

</div>

No.

It seems like you’re trying to upload files instead of using the standard Git worklfow (local repository, commit, push to remote repository).

The current content of your repository is insufficient.

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:28pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/10 "2023-08-02T17:28:15Z")

</div>

im gonna be honest I have no idea how to do that. I tried to follow the guide using actions and workflows but I can’t even do that because the .yaml file breaks despite me just copying the code from the official website

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:29pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/11 "2023-08-02T17:29:29Z")

</div>

if I somehow managed to get that to work would the site publish correctly, or is my code just broken?

---

<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:** [August 2, 2023, 5:35pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/12 "2023-08-02T17:35:14Z")

</div>

I would have no idea without seeing your project. Which is kind of where we started this discussion.

---

<div class="post-metadata">

**Author:** ![pcm19b](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pcm19b/32/20034_2.png) [@pcm19b](https://discourse.gohugo.io/u/pcm19b)\
**Post date:** [August 2, 2023, 5:38pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/13 "2023-08-02T17:38:59Z")

</div>

![Screen Shot 2023-08-02 at 1.37.56 PM](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/f/8/f837e0f126a77c9e7b6011e377f301463c39bc65.jpeg)

I genuinely don’t know, this is me adding all the files in the directory for the site besides themes and public

---

<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:** [August 2, 2023, 5:56pm UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/14 "2023-08-02T17:56:36Z")

</div>

You need to learn the Git workflow, using the command line. If you don’t want to that, you should probably use something other than Hugo.

---

<div class="post-metadata">

**Author:** ![madewithhugo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/madewithhugo/32/20078_2.png) [@madewithhugo](https://discourse.gohugo.io/u/madewithhugo)\
**Post date:** [August 10, 2023, 5:15am UTC](https://discourse.gohugo.io/t/hugo-site-works-beautifully-in-my-local-server-but-is-broken-when-publishing-to-github/45588/15 "2023-08-10T05:15:32Z")

</div>

It’s probably easier to ditch Github pages in favor of Netlify.

- Create Netlify free account \> install Netlify cli on your mac \> from the same folder that has hugo.toml you run **netlify deploy** for first time

- when it asks you what directory to publish, write **public**

- every time you make changes/create new content you run **netlify deploy --prod**  
its so fast and you also get free certificate and all the nice stuff that come with netlify.

- To chain commands I use **hugo --gc --minify && netlify deploy --prod**

- Shout out to @jmooring he is the most dedicated open source dev/supporter out there!
