{"record":{"id":"67baee6638f35340","repo":"goreleaser/goreleaser","slug":"current-folder-is-not-a-git-repository","errorCode":null,"errorMessage":"current folder is not a git repository","messagePattern":"current folder is not a git repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/git/errors.go","lineNumber":32,"sourceCode":"\treturn fmt.Sprintf(\"git is in a dirty state\\nPlease check in your pipeline what can be changing the following files:\\n%v\\nLearn more at https://goreleaser.com/errors/dirty\\n\", e.status)\n}\n\n// ErrWrongRef happens when the HEAD reference is different from the tag being built.\ntype ErrWrongRef struct {\n\tcommit, tag string\n}\n\nfunc (e ErrWrongRef) Error() string {\n\treturn fmt.Sprintf(\"git tag %v was not made against commit %v\", e.tag, e.commit)\n}\n\n// ErrNoTag happens if the underlying git repository doesn't contain any tags\n// but no snapshot-release was requested.\nvar ErrNoTag = errors.New(\"git doesn't contain any tags - either add a tag or use --snapshot\")\n\n// ErrNotRepository happens if you try to run goreleaser against a folder\n// which is not a git repository.\nvar ErrNotRepository = errors.New(\"current folder is not a git repository\")\n\n// ErrNoGit happens when git is not present in PATH.\nvar ErrNoGit = errors.New(\"git not present in PATH\")\n","sourceCodeStart":14,"sourceCodeEnd":36,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/git/errors.go#L14-L36","documentation":"ErrNotRepository is returned when goreleaser is run in a directory that is not a git repository. The git pipe needs repository metadata (commit, tag, branch) to build version info; without a .git directory it cannot proceed. Returned from getInfo at git.go:78 (and in snapshot mode it returns a fakeInfo instead).","triggerScenarios":"Running `goreleaser release`/`goreleaser build` outside any git repo; running inside a subdirectory extracted from a release tarball (no .git); a broken/removed .git directory.","commonSituations":"Running goreleaser in a Docker build context that excluded .git via .dockerignore; CI checking out a repo with git disabled; extracting source archives instead of cloning.","solutions":["Run goreleaser from the root of a valid git clone (`git init` alone also satisfies the check, though a tag is usually needed too).","In CI, ensure the checkout step actually clones with git (e.g. actions/checkout, not a tarball download).","If .git is excluded in Docker, copy it in or use a snapshot build with explicit version injection."],"exampleFix":"# before (Dockerfile)\nCOPY --from=src /src/ /app/\nRUN goreleaser build --snapshot\n# after\nCOPY --from=src /src/.git /app/.git\nCOPY --from=src /src/ /app/\nRUN goreleaser build --snapshot","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(\".git\"); err != nil {\n    return errors.New(\"run goreleaser from inside a git repository\")\n}","typeGuard":null,"tryCatchPattern":"err := git.Pipe{}.Run(ctx)\nif errors.Is(err, git.ErrNotRepository) {\n    log.Fatal(\"current folder is not a git repository\")\n}","preventionTips":["Always run goreleaser from a git clone, not an extracted archive.","Do not exclude .git in Docker builds/copies used for releases.","Verify CI performs a real git checkout."],"tags":["goreleaser","git","environment"],"backgroundTag":"not-a-git-repository","analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}