Skip to content

invalid key: advice.detachedHead #6205

@ran-arigur

Description

@ran-arigur

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

Official binary

Description of the problem

On a system where the git command is Git v2.52.0 (which is the latest version as of this writing), golangci-lint custom -v fails with messaging like this:

INFO Cloning golangci-lint repository             
INFO error: invalid key:  advice.detachedHead
fatal: unable to write parameters to config file 
Error: build process: clone golangci-lint: git clone --branch v2.1.1 --single-branch --depth 1 -c advice.detachedHead=false -q https://github.com/golangci/golangci-lint.git: exit status 128
Failed executing command with error: build process: clone golangci-lint: git clone --branch v2.1.1 --single-branch --depth 1 -c advice.detachedHead=false -q https://github.com/golangci/golangci-lint.git: exit status 128

The issue is that golangci-lint is passing -c advice.detachedHead=false as a single command-line argument with a space in it [code link], which means that the config key is advice.detachedHead with a leading space. (Older versions of Git silently strip out that leading space, but apparently Git v2.52.0 is stricter? Or at least, this is the case with the Git v2.52.0 installed via Homebrew on a Mac. I haven't tested with other systems, and I don't see any documentation about this change.)

This can be fixed either by passing -c and advice.detachedHead=false as two separate arguments, or to pass -cadvice.detachedHead=false as a single argument with no space. (In the latter case I'd suggest writing something like "-c"+"advice.detachedHead=false" for searchability of advice.detachedHead.)

Thanks in advance!

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 2.6.2 built with go1.25.3 from dc16cf43 on 2025-11-14T13:00:52Z

Configuration

# paste configuration file or CLI flags here

Go environment

$ go version && go env
# paste output here

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

A minimal reproducible example or link to a public repository

// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglinter: customAbout custom/private linters

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions