Homebrew: Failed to update / fatal: unable to access macOS Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

Homebrew: Error: Failure while executing; `git fetch --force origin` exited with 128 / fatal: not in a git directory

brew update couldn't fetch the Homebrew repositories — network, a broken git state or safe.directory problems.

Exact message you may see Error: Failure while executing; `git fetch --force origin` exited with 128Homebrew update failed fatal: not in a git directoryError: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core failed!fatal: detected dubious ownership in repository brewFailed to update Homebrew
Seen on: macOS Git

Meaning

Check connectivity and proxy first. If the tap repo is corrupted, reset it: git -C $(brew --repository) fetch --force origin && git -C $(brew --repository) reset --hard origin/master. "Not in a git directory" or "dubious ownership" means git ownership/safe.directory settings need fixing. Try HOMEBREW_NO_AUTO_UPDATE=1 to skip updates temporarily.

Common causes

  • Network/proxy/VPN blocking GitHub
  • Corrupted tap repositories
  • Git safe.directory / ownership issue
  • Disk full
  • Homebrew API cache problems

⚡ Quick fix

  1. brew update-reset
  2. Check network: curl -I https://github.com
  3. git config --global --add safe.directory $(brew --repository)

Detailed fix by platform

macOS

  1. brew update-reset && brew doctor

How to diagnose

  1. Network — GitHub reachable?
  2. Repo — Healthy?
  3. Ownership — Same user?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

Could not resolve host — fatal: unable to access 'https://github.com/…': Could not resolve host: github.com (Git)Could not resolve hostHomebrew Cask: It seems there is already an App at — Homebrew: Error: It seems there is already an App at '/Applications/Chrome.app' (macOS)Homebrew Cask: It see…Homebrew: No available formula with the name — Homebrew: Error: No available formula with the name "x". Did you mean ...? (macOS)Homebrew: No availabl…Homebrew: Permission denied @ dir_s_mkdir — Homebrew: Error: Permission denied @ dir_s_mkdir - /usr/local/Cellar / /opt/homebrew is not writable (macOS)Homebrew: Permission …sed: 1: invalid command code (BSD sed) — macOS: sed: 1: "file.txt": invalid command code f / extra characters at the end of p command (macOS)sed: 1: invalid comma…Your Command Line Tools are too outdated — Homebrew: Error: Your Command Line Tools (CLT) are too outdated. Update them from Software Update / Please update to the latest macOS (macOS)Your Command Line Too…zsh: bad CPU type in executable — macOS (Apple Silicon): zsh: bad CPU type in executable: ./tool (macOS)zsh: bad CPU type in …Homebrew:…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.