jesseduffield/lazygit · error
Your branch has diverged from the remote branch and you've…
Error message
Your branch has diverged from the remote branch and you've disabled force pushing
What it means
Returned by SyncController.requestToForcePush when the user attempts a force push (e.g. via the force-push action on a diverged branch) but UserConfig().Git.DisableForcePushing is true. The confirmation dialog is never shown; instead the error states the branch diverged and force pushing is disabled by configuration.
Solutions
- Reconcile with the remote instead: fetch and merge/rebase onto the upstream, then push normally.
- If force push is truly needed, set git.disableForcePushing: false, retry, and confirm the force-push prompt.
- Push the rewritten work to a new remote branch and open a PR rather than force-updating the shared one.
Example fix
# before # ~/.config/lazygit/config.yml git: disableForcePushing: true # after git: disableForcePushing: false
Defensive patterns
Strategy: validation
Validate before calling
if self.c.UserConfig().Git.DisableForcePushing {
return nil // do not even attempt force-push flows
} Prevention
- Gate force-push actions with the DisableForcePushing config check in DisabledReason.
- Document team policy in the config comment so the guard's purpose is clear.
- When force push is needed, prefer force-with-lease (what lazygit's confirm uses) over blind force.
When it happens
Trigger: Invoking the force-push flow (requestToForcePush) on a branch whose upstream diverged while git.disableForcePushing is set in the lazygit config.
Common situations: Team policies that forbid force pushes; users who enabled the guard earlier and forgot; attempting to update a remote after a local rebase under the guard.
Related errors
- Updates rejected and you have disabled force pushing
- git.diffRenderers: unknown type
- Updates were rejected. Please fetch and examine the remote…
- A remote named ' ' does not exist
- Alias nodes are not supported
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/58fe6dc6ad44cf93.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/gui/controllers/sync_controller.go:240
newOpts := opts
newOpts.force = true
return self.pushAux(currentBranch, newOpts)
},
})
return nil
}
return err
}
self.c.RefreshFromWorker(types.RefreshOptions{})
return nil
})
}
func (self *SyncController) requestToForcePush(currentBranch *models.Branch, opts pushOpts) error {
forcePushDisabled := self.c.UserConfig().Git.DisableForcePushing
if forcePushDisabled {
return errors.New(self.c.Tr.ForcePushDisabled)
}
self.c.Confirm(types.ConfirmOpts{
Title: self.c.Tr.ForcePush,
Prompt: self.forcePushPrompt(),
HandleConfirm: func() error {
opts.forceWithLease = true
return self.pushAux(currentBranch, opts)
},
})
return nil
}
func (self *SyncController) forcePushPrompt() string {
return utils.ResolvePlaceholderString(
self.c.Tr.ForcePushPrompt,
map[string]string{View on GitHub (pinned to c477a2959b)