Blog / git
Find and undo a git setting your coding agent changed
An agent ran git config and now hooks don't run, pulls rebase, or commits go unsigned. List every setting with where it lives, then undo the agent's ones.
On this page
- List everything, with its source
- The settings agents change most
- Undo a setting
- When the setting isn't in any file
- Find out when it changed
- Stop it happening again
- Where Joxo fits
- Frequently asked questions
- How do I see which git config file a setting comes from?
- How do I remove a git config setting?
- Why are my git hooks not running?
- Why does git config say "command line" for a setting I never typed?
- Does git keep a history of config changes?
- Try it with your team
Agents change git settings to get past whatever is in their way. A hook fails, so the agent sets core.hooksPath to /dev/. A pull complains about divergent branches, so it sets pull.rebase globally. Signing asks for a passphrase, so commit.gpgsign goes to false. Each change fixes the agent's problem and quietly changes how git behaves for you, sometimes in every repository on your machine. Here is how to see every setting, where each one comes from, and how to put things back. We ran every command here with git 2.43 on test repositories.
List everything, with its source#
git config --list --show-scope --show-originsystem file:/etc/gitconfig filter.lfs.required=true
global file:/home/dev/.gitconfig user.email=dev@example.com
global file:/home/dev/.gitconfig pull.rebase=true
global file:/home/dev/.gitconfig alias.save=!git add -A && git commit -m wip
local file:.git/config core.hookspath=/dev/null
local file:.git/config commit.gpgsign=falseThe scope column is what matters:
- system is for every user on the machine, usually
/etc/. Agents rarely touch it, since it needs root.gitconfig - global is your user's settings,
~/.gitconfigor~/.config/. A change here follows you into every repository.git/ config - local is this repository's
.git/. It only affects this clone, and it isn't committed, so teammates don't get it.config - worktree is a single worktree's settings, used only if
extensions.is on.worktreeConfig - command means it came from
git -cor from environment variables, not from any file.
For one setting, ask directly:
git config --show-scope --show-origin core.hooksPathlocal file:.git/config /dev/nullGit reads the scopes in order, and the last one wins. A local value beats a global one, and a command-line value beats both.
The settings agents change most#
Look for these first. Each one has a reason an agent reaches for it, and a cost to you:
core.hooksPath. Set to/dev/or an empty folder, it turns off every hook. In our test, a pre-commit hook that failed every commit stopped running the moment this was set, and the commit went through. Your lint, format and secret checks go with it. See stop a coding agent skipping git hooks.null commit.gpgsignandtag.gpgsign. Set to false, commits stop being signed, and a branch that requires signed commits rejects them later.pull.rebaseandpull.ff. These change whatgit pulldoes in every repository when set globally. Rebasing on pull rewrites your local commits, which is a surprise if you're used to merges.user.nameanduser.email. An agent that sets these globally makes your own commits show its name. See fix the author on an agent's commits.core.editor. Agents set it totrueorcatto stop git opening an editor. Your nextgit commitwithout-mthen aborts with an empty message instead of opening your editor.safe.directory. A'*'here turns off a security check for every repository. See git says dubious ownership.alias.*. New aliases are mostly harmless, but one that shadows a habit of yours, or runsgit add -A, is worth removing.core.autocrlfandcore.filemode. These change how files are compared and can make every line look changed; see an agent changed every line.
Undo a setting#
Remove a setting from the scope it's in. Use the scope --show-scope printed:
git config --unset core.hooksPath
git config --unset commit.gpgsign
git config --global --unset pull.rebase
git config --global --unset alias.saveWithout --global, --unset acts on the local scope. If a key has several values, as safe.directory often does, use --unset-all, then add back the ones you want.
Check afterwards:
git config --show-scope --show-origin --get-regexp 'hookspath|gpgsign|pull\.'No output means none of those is set anywhere, and git is back to its defaults for them.
If you'd rather see the whole file, git config --global --edit opens it in your editor. That's often faster when an agent added a dozen lines.
When the setting isn't in any file#
If --show-scope says command, the value comes from the environment the agent ran in. Git reads GIT_, and the pairs GIT_, GIT_ and GIT_. We set core.hooksPath this way and git reported:
command command line: /tmpYou won't find it in any config file. Look in the agent's settings, a wrapper script, a container's environment, or a .envrc file. Your own terminal doesn't have it, which is why the agent sees different behavior from you.
Some agent tools also set their own values this way on purpose, for example to turn off interactive credential prompts. Those only apply to the agent's commands and are usually fine; read what each one does before removing it.
Find out when it changed#
Git doesn't keep a history of config changes. Two things help:
- The agent's own log. Search its session or transcript for
git config. That gives you the exact commands it ran. - A backup next time. Keep a copy of your global settings in your dotfiles repository, or at least run
cp ~/.gitconfig ~/.gitconfig.bakbefore a long unattended run. Thendiff ~/.gitconfig.bak ~/.gitconfigshows what changed.
Stop it happening again#
- Write the rule down. In CLAUDE.md or AGENTS.md: never run
git config --global; never changecore.hooksPath, signing orsafe.directory; if a hook fails, fix the cause or stop and ask. - Make it ask. In Claude Code, add
Bash(git config:*)to theasklist in.claude/, so every config change needs your answer. Asettings.json denyentry blocks it outright. - Keep agents out of your global config. An agent running as its own user, or in a container, has its own
~/.gitconfig. Whatever it changes stays there. - Put the important ones where agents can't reach. A setting in
/etc/needs root to change. Hooks enforced on the server, or by a required check on pull requests, can't be turned off from a laptop at all.gitconfig
Where Joxo fits#
On a team, one person's agent turning off hooks in a shared setup script affects everyone's commits. In Joxo, your agents share one project with notes every agent reads before it starts, so "never touch git config" is a rule written once for every teammate's agent. Setup is one line pasted into your agent.
Frequently asked questions#
How do I see which git config file a setting comes from?#
Run git config --list --show-scope --show-origin. Each line shows the scope (system, global, local, worktree or command) and the file the value was read from.
How do I remove a git config setting?#
Run git config --unset with the key, adding --global if --show-scope says the setting is global. For a key with several values, use --unset-all.
Why are my git hooks not running?#
Check git config --show-origin core.hooksPath. If it's set to /dev/null or an empty folder, git skips every hook. Unset it and the hooks in .git/hooks run again.
Why does git config say "command line" for a setting I never typed?#
It came from environment variables such as GIT_CONFIG_PARAMETERS or GIT_CONFIG_COUNT. Look in the agent's settings, a wrapper script or the container it runs in.
Does git keep a history of config changes?#
No. Search the agent's session log for git config commands, and keep a backup of ~/.gitconfig, ideally in a dotfiles repository, so you can compare later.