{"record":{"id":"58fe6dc6ad44cf93","repo":"jesseduffield/lazygit","slug":"your-branch-has-diverged-from-the-remote-branch-an","errorCode":null,"errorMessage":"Your branch has diverged from the remote branch and you've disabled force pushing","messagePattern":"Your branch has diverged from the remote branch and you've disabled force pushing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/controllers/sync_controller.go","lineNumber":240,"sourceCode":"\t\t\t\t\t\tnewOpts := opts\n\t\t\t\t\t\tnewOpts.force = true\n\n\t\t\t\t\t\treturn self.pushAux(currentBranch, newOpts)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tself.c.RefreshFromWorker(types.RefreshOptions{})\n\t\treturn nil\n\t})\n}\n\nfunc (self *SyncController) requestToForcePush(currentBranch *models.Branch, opts pushOpts) error {\n\tforcePushDisabled := self.c.UserConfig().Git.DisableForcePushing\n\tif forcePushDisabled {\n\t\treturn errors.New(self.c.Tr.ForcePushDisabled)\n\t}\n\n\tself.c.Confirm(types.ConfirmOpts{\n\t\tTitle:  self.c.Tr.ForcePush,\n\t\tPrompt: self.forcePushPrompt(),\n\t\tHandleConfirm: func() error {\n\t\t\topts.forceWithLease = true\n\t\t\treturn self.pushAux(currentBranch, opts)\n\t\t},\n\t})\n\n\treturn nil\n}\n\nfunc (self *SyncController) forcePushPrompt() string {\n\treturn utils.ResolvePlaceholderString(\n\t\tself.c.Tr.ForcePushPrompt,\n\t\tmap[string]string{","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/sync_controller.go#L222-L258","documentation":"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.","triggerScenarios":"Invoking the force-push flow (requestToForcePush) on a branch whose upstream diverged while git.disableForcePushing is set in the lazygit config.","commonSituations":"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.","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."],"exampleFix":"# before\n# ~/.config/lazygit/config.yml\ngit:\n  disableForcePushing: true\n\n# after\ngit:\n  disableForcePushing: false","handlingStrategy":"validation","validationCode":"if self.c.UserConfig().Git.DisableForcePushing {\n    return nil // do not even attempt force-push flows\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["git","force-push","config","divergence"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}