mislav/hub · error
Unknown config %s
Error message
Unknown config %s
What it means
ConfigAll runs `git config --get-regexp <name>` (or `--get-all`) and returns the output lines. This error is returned whenever the underlying `git config` command exits non-zero, which the library interprets as 'the requested config key has no value or the git command failed'. It wraps the raw git exit status into a single error carrying only the config key name, discarding stderr details.
Source
Thrown at git/git.go:262
remoteCmd.Stderr = nil
output, err := remoteCmd.Output()
return outputLines(output), err
}
func Config(name string) (string, error) {
return gitGetConfig(name)
}
func ConfigAll(name string) ([]string, error) {
mode := "--get-all"
if strings.Contains(name, "*") {
mode = "--get-regexp"
}
configCmd := gitCmd(gitConfigCommand([]string{mode, name})...)
output, err := configCmd.Output()
if err != nil {
return nil, fmt.Errorf("Unknown config %s", name)
}
return outputLines(output), nil
}
func GlobalConfig(name string) (string, error) {
return gitGetConfig("--global", name)
}
func SetGlobalConfig(name, value string) error {
_, err := gitConfig("--global", name, value)
return err
}
func gitGetConfig(args ...string) (string, error) {
configCmd := gitCmd(gitConfigCommand(args)...)
output, err := configCmd.Output()
if err != nil {
return "", fmt.Errorf("Unknown config %s", args[len(args)-1])View on GitHub (pinned to 5c547ed804)
Solutions
- Set the config key first: `git config --global <name> <value>` (e.g. git config --global github.user yourlogin).
- Verify the key name/spelling; --get-regexp takes a pattern, so confirm the pattern matches existing keys via `git config --get-regexp <pattern>` manually.
- Check that git is installed and the environment (HOME, XDG_CONFIG_HOME) allows reading user/system config.
- In code, treat this error as 'unset' and fall back to a default or prompt the user instead of failing.
Example fix
// before
val, err := git.ConfigAll("github.user")
if err != nil { return err }
// after
val, err := git.ConfigAll("github.user")
if err != nil {
val = nil // treat as unset, use default or prompt
} Defensive patterns
Strategy: fallback
Validate before calling
if err := exec.Command("git", "config", "--get-regexp", "github.user").Run(); err != nil {
// key unset — use default before calling ConfigAll
} Try / catch
val, err := git.ConfigAll("github.user")
if err != nil {
log.Printf("config github.user unset, using default")
val = defaultVal
} Prevention
- Set all required config keys during setup/onboarding scripts before running the tool.
- Check key existence with `git config --get-regexp` before calling.
- Document required keys and validate them at startup with a clear message.
When it happens
Trigger: Calling ConfigAll(name) where no config entries match the pattern, or where git itself fails (bad gitConfigCommand arguments, missing git binary config, permission errors on config files). Any non-zero exit from configCmd.Output() produces it.
Common situations: Reading an org or per-host setting that was never set (e.g. `github.user`, `hub.host`) before first run; typos in the config key; querying git config in a environment with no HOME set so the global config can't be read; running sync or knownGitHubHosts in CI with a bare/minimal git installation.
Related errors
- unable to select a comment character that is not used in the
- Aborted: no revision could be determined from '%s'
- Error: %s/%s doesn't have a wiki
- the current branch '%s' doesn't seem pushed to a remote
- the branch to compare '%s' is the default branch
AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01).
Data as JSON: /api/errors/7e695fde1cb272d2.
Report an issue: GitHub.