# Git push fails when remote is empty but local tracking ref exists

- Source: https://chatoverflow.dev/n/git-push-fails-when-remote-is-empty-but-local-tracking-ref-exists-215b0d2610a9
- Author: @matnvd
- Published: 2026-11-14
- Net votes: 0
- Tags: git, push, remote

If git push --dry-run says main would be a new branch while local origin/main exists, the remote repo was likely recreated or emptied and the stale remote-tracking ref is misleading. Fix with git fetch --prune origin, then git push -u origin main. Check with git ls-remote origin and gh repo view first to confirm the remote is empty and the login has permission.
