"build.command" failed - Git-related?

I need help! For the last couple of days I haven’t able to deploy my website. I haven’t changed anything that could trigger this error. The error is in the build command (see build log below). I have tried the suggestions I found on this forum (namely setting the “build command: CI= npm run build” and the “publish directory: build”. Could you please help debug this error?

Thank you!

Blockquote

10:34:17 PM: Netlify Build
10:34:17 PM: ────────────────────────────────────────────────────────────────
10:34:17 PM: ​
10:34:17 PM: ❯ Version
10:34:17 PM: @netlify/build 29.4.0
10:34:17 PM: ​
10:34:17 PM: ❯ Flags
10:34:17 PM: baseRelDir: false
10:34:17 PM: buildId: 63b79692ff5fe700086f42d2
10:34:17 PM: deployId: 63b79692ff5fe700086f42d4
10:34:17 PM: ​
10:34:17 PM: ❯ Current directory
10:34:17 PM: /opt/build/repo
10:34:17 PM: ​
10:34:17 PM: ❯ Config file
10:34:17 PM: /opt/build/repo/netlify.toml
10:34:17 PM: ​
10:34:17 PM: ❯ Context
10:34:17 PM: production
10:34:17 PM: ​
10:34:17 PM: 1. build.command from netlify.toml
10:34:17 PM: ────────────────────────────────────────────────────────────────
10:34:17 PM: ​
10:34:17 PM: $ hugo
10:34:18 PM: ERROR 2023/01/06 03:34:18 Failed to read Git log: bfbea3b5c45107d3fe9119ffbb08c1c0d01813abbfbea3bupdate tomlxx@gmail.com2023-01-05 22:33:33 -0500
10:34:18 PM: netlify.toml
10:34:18 PM: 81f59732038802d1acaa69aecef5a8592ce2153981f5973update netlifyxx@gmail.com2023-01-05 22:27:51 -0500
10:34:18 PM: netlify.toml
10:34:20 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
10:34:18 PM: Host key verification failed.
10:34:18 PM: fatal: Could not read from remote repository.
10:34:18 PM: Please make sure you have the correct access rights
10:34:18 PM: and the repository exists.
10:34:18 PM: fatal: could not fetch 46c8cf461883fe3c30c263ba91b54ab76654b38a from promisor remote
10:34:18 PM: Building sites …
10:34:18 PM: Total in 155 ms
10:34:18 PM: Error: Error building site: logged 1 error(s)
10:34:18 PM: ​
10:34:18 PM: “build.command” failed
10:34:18 PM: ────────────────────────────────────────────────────────────────
10:34:18 PM: ​
10:34:18 PM: Error message
10:34:18 PM: Command failed with exit code 255: hugo (Search results for '"non-zero exit code: 255"' - Netlify Support Forums)
10:34:18 PM: ​
10:34:18 PM: Error location
10:34:18 PM: In build.command from netlify.toml:
10:34:18 PM: hugo
10:34:18 PM: ​
10:34:18 PM: Resolved config
10:34:18 PM: build:
10:34:18 PM: command: hugo
10:34:18 PM: commandOrigin: config
10:34:18 PM: environment:
10:34:18 PM: - CI
10:34:18 PM: - HUGO_VERSION
10:34:18 PM: - HUGO_ENV
10:34:18 PM: - HUGO_ENABLEGITINFO
10:34:18 PM: publish: /opt/build/repo/public
10:34:18 PM: publishOrigin: config
10:34:19 PM: Caching artifacts
10:34:19 PM: Started saving build plugins
10:34:19 PM: Finished saving build plugins
10:34:19 PM: Started saving pip cache
10:34:19 PM: Finished saving pip cache
10:34:19 PM: Started saving emacs cask dependencies
10:34:19 PM: Finished saving emacs cask dependencies
10:34:19 PM: Started saving maven dependencies
10:34:19 PM: Finished saving maven dependencies
10:34:19 PM: Started saving boot dependencies
10:34:19 PM: Finished saving boot dependencies
10:34:19 PM: Started saving rust rustup cache
10:34:19 PM: Finished saving rust rustup cache
10:34:19 PM: Started saving go dependencies
10:34:19 PM: Finished saving go dependencies
10:34:19 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:34:20 PM: Failing build: Failed to build site
10:34:20 PM: Finished processing build request in 17.700513409s

1 Like

Having the same problem, ‘Failed to read Git log’

Hi @bienflorencia and @rmarto :wave:t6: , welcome to the forums! Can you try relinking your your repository.

If that doesn’t work can you please share your site name, repository and what you have already tried to resolve the issue.

Hi @SamO, thanks for your reply. How do I relink the repository exactly?

Hi @rmarto :wave:t6: ,

Actually scratch that… I possibly found a solution since I saw you are using the Hugo Framework. Can you check my response here and see if that helps?

Hi @SamO,
Where can I find the “GIT_CONFIG_NOSYSTEM”?

@rmarto That post mentions that GIT_CONFIG_NOSYSTEM is an environment variable, and they can be set several ways, you may want to just read the appropriate section of the documentation:

Thank you, I created the environment variable GIT_CONFIG_NOSYSTEM in Netlify and then triggered the deployment, and it’s still failing with the same error. Any other solutions? Thank you!

I changed in netlify.toml

HUGO_ENABLEGITINFO = “false”

(it was “true” before) and it worked. I also kept the environment variable

GIT_CONFIG_NOSYSTEM=“true”.

Will I run into further issues?

Hi @rmarto :wave:t6:,

With updating the build command you shouldn’t experience this any longer but if you do please don’t hesitate to reach back out. (: