{"record":{"id":"b201f7a356226115","repo":"jesseduffield/lazygit","slug":"updates-rejected-and-you-have-disabled-force-pushi","errorCode":null,"errorMessage":"Updates rejected and you have disabled force pushing","messagePattern":"Updates rejected and you have disabled force pushing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/controllers/sync_controller.go","lineNumber":216,"sourceCode":"\t\terr := self.c.Git().Sync.Push(\n\t\t\ttask,\n\t\t\tgit_commands.PushOpts{\n\t\t\t\tForce:          opts.force,\n\t\t\t\tForceWithLease: opts.forceWithLease,\n\t\t\t\tCurrentBranch:  currentBranch.Name,\n\t\t\t\tUpstreamRemote: opts.upstreamRemote,\n\t\t\t\tUpstreamBranch: opts.upstreamBranch,\n\t\t\t\tSetUpstream:    opts.setUpstream,\n\t\t\t})\n\t\tif err != nil {\n\t\t\tif !opts.force && !opts.forceWithLease && strings.Contains(err.Error(), \"Updates were rejected\") {\n\t\t\t\tif opts.remoteBranchStoredLocally {\n\t\t\t\t\treturn errors.New(self.c.Tr.UpdatesRejected)\n\t\t\t\t}\n\n\t\t\t\tforcePushDisabled := self.c.UserConfig().Git.DisableForcePushing\n\t\t\t\tif forcePushDisabled {\n\t\t\t\t\treturn errors.New(self.c.Tr.UpdatesRejectedAndForcePushDisabled)\n\t\t\t\t}\n\t\t\t\tself.c.Confirm(types.ConfirmOpts{\n\t\t\t\t\tTitle:  self.c.Tr.ForcePush,\n\t\t\t\t\tPrompt: self.forcePushPrompt(),\n\t\t\t\t\tHandleConfirm: func() error {\n\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})","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/sync_controller.go#L198-L234","documentation":"Returned by SyncController.pushAux in the same 'Updates were rejected' path as error 91, but when the remote branch is NOT stored locally and UserConfig().Git.DisableForcePushing is true. lazygit would normally offer a force-push confirmation here, but the config option forbids it, so the rejection is surfaced with an explanation that force pushing is disabled.","triggerScenarios":"A non-force push rejected with 'Updates were rejected', remoteBranchStoredLocally == false, and git.disableForcePushing: true in the user config.","commonSituations":"Users who deliberately set disableForcePushing to protect shared branches; pushing a brand-new local view of a remote branch after history was rewritten elsewhere.","solutions":["Fetch the remote branch, examine the divergence, and reconcile (merge/rebase) before pushing.","If force pushing is genuinely required, remove or set git.disableForcePushing: false in the lazygit config, then retry and confirm.","Push to a different branch name if overwriting the remote is unacceptable."],"exampleFix":"# before\n# ~/.config/lazygit/config.yml\ngit:\n  disableForcePushing: true\n\n# after\ngit:\n  disableForcePushing: false","handlingStrategy":"fallback","validationCode":"if self.c.UserConfig().Git.DisableForcePushing {\n    // reconcile with remote (fetch + rebase/merge) instead of pushing over it\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep git.disableForcePushing: true for shared branches and always fetch-and-rebase on rejection.","Surface the config setting in the error UX so users know why force push was not offered.","Use dedicated throwaway branches when history rewrites are expected."],"tags":["git","push","force-push","config"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}