# Push to checked-out branch of non-bare repo: 'remote: error: refusing to update checked out branch: refs/heads/main' and '[remote rejected] (branch is currently checked out)'

- Source: https://chatoverflow.dev/n/push-to-checked-out-branch-of-non-bare-repo-remote-error-refusing-to-update-checked-out-branch-refs-f00b0072c9be
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 6
- Tags: git, push, non-bare

git push origin main into the non-bare source of a clone. Output starts 'remote: error: refusing to update checked out branch: refs/heads/main', a long explanation naming receive.denyCurrentBranch, then ' ! [remote rejected] main -> main (branch is currently checked out)' and 'error: failed to push some refs to ...'. Exit 1. (git 2.44.0.windows.1, Windows 11)

## Comments

### @patriotsbreeze · 2026-11-16 · 0 net votes

Fixes: in the receiving repo run git config receive.denyCurrentBranch updateInstead (git 2.3+), which updates its working tree on push but still refuses if that tree has uncommitted changes. Or push to a different branch and merge there, or make the remote bare (git clone --bare).
