# Deploying failed with a hugo theme from github

**URL:** <https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012>\
**Category:** Support\
**Tags:** deployment, hugo\
**Created:** [September 12, 2021, 3:37am UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012 "2021-09-12T03:37:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![moses](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@moses](https://answers.netlify.com/u/moses)\
**Post date:** [September 12, 2021, 3:37am UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012/1 "2021-09-12T03:37:41Z")

</div>

I tried deploying airspace-hugo theme from github. I am getting this result, please help me;

4:09:30 AM: ​  
4:09:30 AM: Error message  
4:09:30 AM: Command failed with exit code 255: cd exampleSite && hugo --gc --themesDir …/…  
4:09:30 AM: ​  
4:09:30 AM: Error location  
4:09:30 AM: In build.command from netlify.toml:  
4:09:30 AM: cd exampleSite && hugo --gc --themesDir …/…  
4:09:30 AM: ​  
4:09:30 AM: Resolved config  
4:09:30 AM: build:  
4:09:30 AM: command: cd exampleSite && hugo --gc --themesDir …/…  
4:09:30 AM: commandOrigin: config  
4:09:30 AM: environment:  
4:09:30 AM: - HUGO\_VERSION  
4:09:30 AM: - HUGO\_THEME  
4:09:30 AM: - HUGO\_BASEURL  
4:09:30 AM: publish: /opt/build/repo/exampleSite/public  
4:09:30 AM: publishOrigin: config  
4:09:30 AM: redirects:  
4:09:31 AM: - from: /de/\*  
status: 404  
to: /de/404.html  
- from: /fr/\*  
status: 404  
to: /fr/404.html  
- from: /it/\*  
status: 404  
to: /it/404.html  
- from: /\*  
status: 404  
to: /404.html  
redirectsOrigin: config  
Caching artifacts  
4:09:31 AM: Started saving build plugins  
4:09:31 AM: Finished saving build plugins  
4:09:31 AM: Started saving pip cache  
4:09:31 AM: Finished saving pip cache  
4:09:31 AM: Started saving emacs cask dependencies  
4:09:31 AM: Finished saving emacs cask dependencies  
4:09:31 AM: Started saving maven dependencies  
4:09:31 AM: Finished saving maven dependencies  
4:09:31 AM: Started saving boot dependencies  
4:09:31 AM: Finished saving boot dependencies  
4:09:31 AM: Started saving rust rustup cache  
4:09:31 AM: Finished saving rust rustup cache  
4:09:31 AM: Started saving go dependencies  
4:09:31 AM: Finished saving go dependencies  
4:09:33 AM: Build failed due to a user error: Build script returned non-zero exit code: 2  
4:09:33 AM: Creating deploy upload records  
4:09:33 AM: Failing build: Failed to build site  
4:09:33 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2  
4:09:34 AM: Finished processing build request in 15.569454243s

Thanks

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [September 12, 2021, 8:55am UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012/2 "2021-09-12T08:55:17Z")

</div>

Hi @moses

Are you able to share your git repository?  
Also your build settings.

---

<div class="post-metadata">

**Author:** ![moses](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@moses](https://answers.netlify.com/u/moses)\
**Post date:** [September 12, 2021, 12:29pm UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012/3 "2021-09-12T12:29:38Z")

</div>

This is my netlify.toml ;

[build]  
command = “hugo --minify --gc”  
publish = “public”  
[build.environment]  
HUGO\_VERSION = “0.87.0”  
HUGO\_THEME = “repo”  
HUGO\_BASEURL = “/”

[[headers]]  
for = “/\*”  
[headers.values]  
Referrer-Policy = “same-origin”  
Strict-Transport-Security = “max-age=31536000; includeSubDomains; preload”  
X-Frame-Options = “DENY”  
X-XSS-Protection = “1; mode=block”

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [September 12, 2021, 1:14pm UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012/4 "2021-09-12T13:14:55Z")

</div>

There is a discrepancy in the information you have provided.

You say this is the _build command_ in your `netlify.toml`

> [@moses](#):
>
> [build]  
> command = “hugo --minify --gc”

however the _build command_ in the log in your first post shows a different command.

> [@moses](#):
>
> 4:09:30 AM: In build.command from netlify.toml:  
> 4:09:30 AM: cd exampleSite && hugo --gc --themesDir …/…

---

<div class="post-metadata">

**Author:** ![moses](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@moses](https://answers.netlify.com/u/moses)\
**Post date:** [September 12, 2021, 1:17pm UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012/5 "2021-09-12T13:17:53Z")

</div>

Thanks but that is what is in my build settings. And that is the log displayed

---

<div class="post-metadata">

**Author:** ![hillary](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hillary/32/21132_2.png) [@hillary](https://answers.netlify.com/u/hillary)\
**Post date:** [September 13, 2021, 2:08pm UTC](https://answers.netlify.com/t/deploying-failed-with-a-hugo-theme-from-github/44012/6 "2021-09-13T14:08:14Z")

</div>

Hi there, @moses

Sorry to hear you are stuck. We have lots of great resources that offer some debugging advice for you to work through. I would recommend starting with the following two:

> **[Build troubleshooting tips](https://docs.netlify.com/build/configure-builds/troubleshooting-tips/)**
>
> Find troubleshooting tips for failing builds, learn how to address certain build errors, and access additional support resources.

> [@\[Support Guide\] Debugging Netlify site builds](https://answers.netlify.com/t/support-guide-debugging-netlify-site-builds/142):
>
> Last reviewed by Netlify Support - July 2025 Note: This article is only about builds within Netlify’s Continuous Integration (CI) environment, as [triggered from git commits](https://docs.netlify.com/site-deploys/create-deploys/#deploy-with-git) or from [incoming build webhooks](https://docs.netlify.com/configure-builds/build-hooks/). You can learn more in depth about how Netlify builds your site in this [article about how our build bots build sites](https://www.netlify.com/blog/2016/10/18/how-our-build-bots-build-sites/). Some background There are a fair number of reasons that a build could fail in Netlify’s CI environment, even if building works locally. Testing locally is always the place to …

If you work through those and are still having difficulties, please follow up here with the steps you have tried, your Netlify site name, and your git repository.

Thanks!
