GITCONFIG INCLUDEIF CHECKER · RUNS IN YOUR BROWSER · NOTHING UPLOADED

Why is git using the wrong email in this repository?

Paste your ~/.gitconfig and the files it includes, and say where the repository is. The checker reads them the way git does and tells you which [includeIf] lines took effect, why the others did not, and which file and line set user.email and every other value.

It names the usual causes:

Nothing you paste leaves this browser tab. Checked against git config --list --show-origin (git 2.43) on thousands of random config trees, linked worktrees and symlinked folders (see the README); your own git is the final word.

1. Your config files

Paste ~/.gitconfig. For more files, start each with a line ==> path <==, which is what head prints for several files, so head -n 9999 ~/.gitconfig ~/.gitconfig-* .git/config gives you the lot. ~/ in a header means your home folder. Include .git/config (shown as ==> ~/work/api/.git/config <==) if you use hasconfig:remote.*.url:, or list the remote URLs below.

2. The repository

echo $HOME, git rev-parse --show-toplevel and git branch --show-current print these. Leave the branch empty for a detached HEAD (CI, bisect, a rebase). Leave the repository empty to see what git reads outside any repository.

cd "$(git rev-parse --absolute-git-dir)" && pwd -P prints the real path. For a linked worktree, git rev-parse --absolute-git-dir prints its .git folder, which lives inside the main repository.

git remote -v lists them. Used only when you have not pasted the repository's .git/config.

Why does this setting have this value?

Every value of one setting, in the order git reads them, and the include chain each came through. For single-valued settings the last one wins.

    From a terminal

    The same engine reads the files on your machine, with no install and no network: /etc/gitconfig, ~/.config/git/config, ~/.gitconfig, the repository's .git/config and config.worktree, and every file they include, with the real path and the branch read from the repository itself. --verify runs your own git config --list --show-origin and reports any value that differs.

    node ventures/gitconfig-include-check/cli/check.mjs                    # report for the repository you are in
    node ventures/gitconfig-include-check/cli/check.mjs --key user.email   # every value of one setting, and why
    node ventures/gitconfig-include-check/cli/check.mjs --verify           # compare with git config --list
    node ventures/gitconfig-include-check/cli/check.mjs --strict           # exit 1 on a high finding

    Clone the source, then run it from inside a repository. Node 18 or later.

    Questions

    Why is my includeIf gitdir not working?

    The usual causes: the pattern has no trailing slash (gitdir:~/work only matches a .git folder that is exactly ~/work; write gitdir:~/work/), the [includeIf] block sits above the [user] section it should override (git reads top to bottom and the last value wins, so put the include at the end of ~/.gitconfig), the condition has a typo or a space (GitDir:, gitdir: ~/work/), the path = line points at a file that does not exist (git skips it without a word), or ~/work is a symlink (from a subfolder git sees the real path).

    Why does git still use my personal email in work repositories?

    Run git config --show-origin --get-all user.email inside the repository: the last line printed wins. If the work address is listed first, your [includeIf] block comes before the [user] section in ~/.gitconfig; move it below. If the work address is missing, the condition did not match or the included file was not found.

    What does gitdir: compare against?

    The path of the repository's .git folder, with ~/ expanded to your home folder, not the folder you cd into. A pattern ending in / gets ** added so it matches everything below it; a pattern that does not start with ~/, / or ./ gets **/ in front so it matches at any depth. For a linked worktree the .git folder lives inside the main repository's .git/worktrees/, so the main repository's location decides.

    Does onbranch: work in CI?

    Only when a branch is checked out. On a detached HEAD, which is how most CI systems check out a commit or a pull request, and during git bisect or a rebase, git skips every onbranch: include.

    Is anything I paste uploaded?

    No. The checker runs entirely in this browser tab. There are no accounts, cookies or analytics vendors, and the command-line version makes no network calls.