Skip to content
Recovery

Safe Mode

What triggers it, what it locks, why it pins core.hooksPath=/dev/null, and how to leave it.

GitAegis
The GitAegis Safe Mode banner, shown when the index or HEAD cannot be trusted, with mutating controls locked out.
When the index or HEAD can't be trusted, the controls that would make it worse lock.

It is a conclusion, not a switch

Safe Mode is not a setting you turn on. It is a state GitAegis derives from Doctor’s evidence, and it means one thing: the repository’s index or HEAD cannot be trusted. It is set when any of these is true:

  • reading .git/index failed;
  • the index signature is wrong;
  • the index checksum is wrong;
  • the index is truncated;
  • reading HEAD failed.

It appears as a banner above every Doctor tab, a chip in the status bar, a badge on the repository card, and a badge on Doctor’s overview. It applies to one repository, not to the application.

What it locks

  • This repository’s hooks do not run. Every Git subcommand GitAegis spawns for a Safe Mode repository carries core.hooksPath=/dev/null, including the write subcommands a repair issues.
  • No account or provider state can unlock a mutation. The Safe Mode refusal is decided locally. Optional update, account, AI, or provider traffic cannot authorize or execute a Git operation.
  • Maintenance tasks are refused.
  • This repository’s configuration is not written. Saving an author identity to repository scope is refused; saving it to your global configuration is not, because your own config file is not the damaged repository.
  • Mutating controls are disabled in the interface: fetch, pull, push, force push, create branch, create stash, apply stash, staging and unstaging, the commit composer, conflict resolution, and the Flight Recorder’s Resume, which is the same sequencer continue as Work’s, so it is held by the same rule. Each disabled control explains why on hover.
The Safe Mode banner above Doctor's tabs, naming the index read that failed and stating what GitAegis will not do while the repository is in Safe Mode.
The banner states the refusals in full, and names the read that failed.

Read paths stay open. History, diffs, refs and the Flight Recorder are all still readable, because diagnosis needs reading and reading cannot make it worse. Capsule restore and Lost Work both work in Safe Mode; they are part of the reason it exists.

Why core.hooksPath is pinned to /dev/null

A hook is a program the repository asks Git to run. On a repository whose index or HEAD is already untrustworthy, running its programs during a diagnosis or a repair adds an uncontrolled write to a situation that exists because writes went wrong. Pinning core.hooksPath to /dev/null through the pinned GIT_CONFIG_* environment is the one way to hold that off from outside the repository, because a repository’s own configuration cannot override it. Outside Safe Mode your hooks still run on write paths, as they should.

Two things Safe Mode does not do

  • External diff and merge tools are never run, in any mode. That is a property of every GitAegis invocation, not a Safe Mode protection. Earlier wording gave Safe Mode credit for it; it does not deserve the credit.
  • Content filters are not sandboxed. A filter.<driver> declared by the repository’s own .gitattributes can still run during a repair that restores files: merge --abort and rebase --abort materialise the working tree, which is precisely what those repairs are for. Git offers no way to disable filters wholesale from the command line, so this claim was retracted rather than implemented. If a repository’s filters are themselves suspect, repair it from a shell instead.

How to leave it

Safe Mode is a symptom, not a fix, and there is no control that dismisses it. Run a fresh scan from Doctor → Overview, read the findings, and apply the recommended repair. Every repair takes a mandatory capsule first. There is no override for that. When the underlying evidence clears, the state clears with it.

A damaged index is usually the easiest of these to survive, because the index can be rebuilt from HEAD and your files are untouched:

zsh
cd /path/to/repository
# keep the evidence
cp .git/index /tmp/broken-index
rm .git/index
# rebuilds the index from HEAD
git reset
git status
Your staged/unstaged distinction is lost by this; your file contents are not.

If GitAegis has a capsule from before the damage, restoring its index domain is the better route, because it preserves staging.

30-day trial · No card required

A recovery capsule before every risky Git operation.

You see the exact commands before they run, and the operation is refused if the capsule cannot be written.

Requires Git 2.38.0 or newer, already installed.

Every risky operation, in this order

  1. Previewthe exact commands, shown before anything runs
  2. Capsulerefs, index, staged and working changes, untracked files, operation state: written to disk first
  3. Executethe commands as shown, or not at all
  4. Journalplan, commands, capsule id, outcome
No capsule, no operation. Restore plans, previews, and takes its own capsule.