{"record":{"id":"74c1c28316ea6932","repo":"gohugoio/hugo","slug":"failed-to-load-git-data-w","errorCode":null,"errorMessage":"failed to load Git data: %w","messagePattern":"failed to load Git data: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__new.go","lineNumber":90,"sourceCode":"\t\t\tShortcodeInfoProvider:      page.NopPage,\n\t\t\tLanguageProvider:           s,\n\t\t\tRelatedDocsHandlerProvider: s,\n\t\t\tm:                          m,\n\t\t\ts:                          s,\n\t\t},\n\t}\n\n\tif ps.IsHome() && ps.PathInfo().IsLeafBundle() {\n\t\tmsg := \"Using %s in your content's root directory is usually incorrect for your home page. \"\n\t\tmsg += \"You should use %s instead. If you don't rename this file, your home page will be \"\n\t\tmsg += \"treated as a leaf bundle, meaning it won't be able to have any child pages or sections.\"\n\t\tps.s.Log.Warnidf(constants.WarnHomePageIsLeafBundle, msg, ps.PathInfo().PathNoLeadingSlash(), strings.ReplaceAll(ps.PathInfo().PathNoLeadingSlash(), \"index\", \"_index\"))\n\t}\n\n\tif m.f != nil {\n\t\tgi, err := s.h.gitInfoForPage(ps)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load Git data: %w\", err)\n\t\t}\n\t\tps.gitInfo = gi\n\t\towners, err := s.h.codeownersForPage(ps)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load CODEOWNERS: %w\", err)\n\t\t}\n\t\tps.codeowners = owners\n\t}\n\n\tps.pageMenus = &pageMenus{p: ps}\n\tps.PageMenusProvider = ps.pageMenus\n\tps.GetPageProvider = pageSiteAdapter{s: s, p: ps}\n\tps.GitInfoProvider = ps\n\tps.TranslationsProvider = ps\n\tps.ResourceDataProvider = newDataFunc(ps)\n\tps.RawContentProvider = ps\n\tps.ChildCareProvider = ps\n\tps.TreeProvider = pageTree{p: ps}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page__new.go#L72-L108","documentation":"Raised during page creation (page__new.go:90) when Hugo fails to assemble Git authoring metadata for a page file. It delegates to HugoSites.gitInfoForPage which runs the one-shot loadGitInfo (hugo_sites.go:546) gated by enableGitInfo; the inner newGitInfo (gitinfo.go:110) maps the local repo and any Git submodule modules. The wrapped error is the underlying git/gitmap failure.","triggerScenarios":"enableGitInfo = true is set but the project directory is not inside a Git repository; the git binary is missing from PATH; a Hugo module points to a remote that cannot be cloned/fetched; the local repo log read fails (corrupt repo, shallow clone issues, permission denied on .git).","commonSituations":"CI builds that check out shallow clones or detached trees without .git; building on a fresh machine where git is not installed; a submodule mount whose origin URL is unreachable behind a proxy; switching a project to enableGitInfo after the fact without running `git init`.","solutions":["Ensure the project root is an initialized Git repo (`git status` works) and that `git` is on PATH in the build environment.","If you do not need Git metadata, remove or set `enableGitInfo = false` in hugo.toml.","For shallow CI clones, fetch full history or disable enableGitInfo for that pipeline.","If a Hugo module remote is involved, verify network/proxy access and run `hugo mod vendor` to remove the runtime fetch."],"exampleFix":"# before\n# hugo.toml\nenableGitInfo = true\n# built in a CI checkout with depth=1 and no .git\n\n# after: either give it real history\ngit fetch --unshallow\n# or turn the feature off\nenableGitInfo = false","handlingStrategy":"validation","validationCode":"# Validate preconditions before invoking hugo with enableGitInfo.\ntest -d .git || { echo \"not a git repo\"; exit 1; }\ncommand -v git >/dev/null || { echo \"git not installed\"; exit 1; }\ngit rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In CI, either fetch full history or set enableGitInfo=false for shallow clones.","Run `git status` as a smoke test in your build pipeline before `hugo`.","Vendor Hugo modules (`hugo mod vendor`) to avoid remote fetches during gitInfo load."],"tags":["git","configuration","ci","metadata"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}