non-bare push 🌿 Git

! [remote rejected] main -> main (branch is currently checked out)

You pushed to a non-bare repository whose working tree has that branch checked out.

Seen on: Git

Meaning

Pushing into a repo with a working copy would desynchronise it. Remotes for pushing should be bare repos.

Common causes

  • Remote created with git init instead of git init --bare
  • Pushing to a deploy directory directly

⚡ Quick fix

  1. Recreate the remote as bare: git init --bare repo.git
  2. Or set receive.denyCurrentBranch updateInstead on the server repo

Detailed fix by platform

Git

  1. git config receive.denyCurrentBranch updateInstead # on the server repo

How to diagnose

  1. Remote — Bare repository?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 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.