GitHub: why the merge method was refused
A pull request is merged with PUT /repos/OWNER/REPO/pulls/NUMBER/merge, whose merge_method is merge, squash or rebase; GitHub's documentation answers 405 "if merge cannot be performed". Auto-merge (GraphQL enablePullRequestAutoMerge) takes a merge method too. The methods a repository allows are in its settings, which GET /repos/OWNER/REPO gives as allow_merge_commit, allow_squash_merge and allow_rebase_merge, next to allow_auto_merge and delete_branch_on_merge. A branch's protection or rulesets can narrow them further (checked October 25, 2026).
HTTP/1.1 405 Method Not Allowed
{"message": "Squash merges are not allowed on this repository."}
GitHub's words and the reasons
Merge commits are not allowed on this repository.,Squash merges are not allowed on this repository.,Rebase merges are not allowed on this repository.: the method sent is not allowed. Public reports from 2026 met all three, the squash one as 405.- The repository's settings do not tell what a branch allows: a public report from 2026 read
allow_merge_commitas true and still gotMerge commits are not allowed on this repository., because the target branch's protection required a linear history; GitHub's rulesets endpoint for that branch returned an empty list. This branch must not contain merge commits.(405 in a public report from 2024, followed by "You're not authorized to push to this branch."): the branch requires a linear history. GitHub's documentation says enforcing a linear history prevents anyone from pushing merge commits to a protected branch.- A ruleset's merge methods: the documentation says merge methods set on the repository that conflict with a ruleset's merge method rule prevent merging; for example, if the repository does not allow rebase merging and the rule allows only rebase on a branch, that merge is not possible. A public report from 2026 met
Merge method merge commits are not allowed on this repositoryfromenablePullRequestAutoMergewhen the branch's ruleset allowed squash only. - Settings a token cannot see: the documentation says that viewing the merge-related settings of a repository needs the contents read and write permissions.
- Rebase and merge: the documentation says contributors may first have to rebase on the command line, resolve conflicts and force push before rebase and merge can be used (see Rebase and merge not available).
What to do
- Pick another method: one the repository allows and the target branch's rules allow too; a branch with a linear history takes squash or rebase.
- See the branch's rules: the rulesets that apply to a branch are at
GET /repos/OWNER/REPO/rules/branches/BRANCH; a classic branch protection'srequired_linear_historyis in its protection settings. - Change what is allowed: a repository administrator sets the methods in the repository's Settings, General, Pull Requests, and the branch's rules in its protection or rulesets.
- Refused for another reason: see why GitHub refused the merge (405, 409), or for auto-merge GitHub auto-merge refused.
In IntelliJ IDEA: the methods follow the repository settings only, read once
How the GitHub support built into IntelliJ IDEA picks the merge method, in its source (checked October 31, 2026; IntelliJ IDEA: GHPRDetailsActionsComponentFactory.kt, GHPRReviewFlowViewModelImpl.kt, GHPRSecurityServiceImpl.kt, repository.graphql, refUpdateRule.graphql, GHPRMergeabilityStateBuilder.kt, GithubApiRequests.kt):
- What it offers: it reads the repository's
mergeCommitAllowed,squashMergeAllowedandrebaseMergeAllowed(the GraphQL names of the three settings above) once, when it connects to the repository, and a method not allowed there stays off. The merge button shows the first allowed of Merge…, Squash and Merge… and Rebase, with the other two in its drop-down. It appears once the pull request counts as approved (for a reviewer, once their own review is no longer requested); before that, and when you are neither the author nor a reviewer, the three are only in the more-actions menu, under Merge Review…. - What it does not look at: the target branch's linear-history requirement is fetched with its rule but not used for the buttons, and no ruleset is read, so neither turns a method off. A setting changed in the repository after it connected does not reach the buttons until it connects again. In these cases GitHub can refuse with the 405 above.
- It sends the method with the REST endpoint above:
merge_methodset tomerge,squashorrebase, with the head it last loaded assha. Merge… and Squash and Merge… first ask for the commit message (Squash and Merge… fills it with the first line of each commit as a list); Rebase sends at once. - When GitHub refuses, nothing appears on screen (see the IntelliJ IDEA part of the not mergeable page). For the reason, read the repository's settings and the branch's rules with the requests above.
GitHub pull requests in IntelliJ IDEA
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, offers the merge methods the repository's settings allow (create a merge commit, squash and merge, rebase and merge; all three when the settings are not visible to the token), and sets "delete the branch after merging" from delete_branch_on_merge. It also reads the rules on the target branch (GET /repos/{owner}/{repo}/rules/branches/{branch}) and leaves out what a ruleset forbids: methods missing from a pull request rule's allowed_merge_methods, and merge commits under required linear history. It says "the only method" only when the settings or the rules are known. A branch's classic protection is not read, so a method it forbids can still be offered; when GitHub answers that the repository does not allow the method, the plugin says so with GitHub's words and asks for another method in the merge dialog (it does not point to approvals or checks); other refusals, such as a branch rule's, are shown with GitHub's words, and squash or rebase is the way on a branch with a linear history. The review inbox, diffs and conversations are free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.
More: GitHub merge refused (405, 409) · GitHub review refused (422) · GitHub search 422 "Validation Failed" · "Resource not accessible by personal access token" · 401 "Bad credentials" · "Resource protected by organization SAML enforcement" · "API rate limit exceeded" · GitHub diff 406 "too_large", 3,000 files · GitHub line comment 422 "must be part of the diff" · GitHub branch update refused (422) · GitHub pull request not created (422, 403) · GitHub auto-merge refused · GitHub draft, ready for review or close refused · GitHub conversation not resolved · GitHub checks not shown (check runs 403) · GitHub file contents not read · GitHub compare refused (404, 422) · GitHub comment or reply refused (403 locked, archived) · GitHub branch not found (404, 301) · GitHub Enterprise Server not reached · GitHub review request not shown · GitHub pull request list incomplete · GitHub 404 Not Found, renamed repositories (301, 307) · GitHub line comment outdated or not on the diff · GitHub pull requests not updating, notifications late · GitHub suggested change cannot be applied · GitHub required check stuck at "Expected" · GitHub code owner review required · GitHub merge blocked by unresolved conversations · GitHub merge blocked by unsigned commits · GitHub branch that merges through a merge queue · GitHub merge waiting for an approval of the most recent push · GitHub merge waiting for code scanning results · GitHub merge waiting for code quality results · GitHub merge blocked by a code coverage threshold · GitHub merge blocked by license compliance results · GitHub branch locked or its updates restricted · GitHub branch not deleted after merging · GitHub merge waiting for a team's approval (Required reviewers) · GitHub merge blocked by secret scanning alerts · GitHub stacked pull request not merging · GitHub push blocked by push rules · GitHub merge blocked by commit metadata rules · GitHub force push blocked · GitHub issue not closed by a merged pull request · GitHub pull request not checked out locally · GitHub pull request has merge conflicts · GitHub changes requested and dismissing a review · GitHub co-author not credited for a commit · GitHub dependency review check failed · GitHub Dependabot not rebasing its pull request · GitHub fork not syncing with upstream · GitHub pull request base branch not changing · GitHub pull request not reverting · GitHub pull request template not showing · GitHub pull request labels or assignees not added · GitHub pull request not closing or reopening · GitHub push blocked by push protection · GitHub pull request comment hidden · GitHub pull request blocked until deployments succeed · GitHub team review request replaced by members · GitHub pull request file no longer marked Viewed · GitHub pull request marked merged without being merged · GitHub Copilot review does not count as an approval · GitHub checks not running on a pull request a workflow created · GitHub Update branch button not shown on a pull request · GitHub checks failing on a Dependabot pull request · GitHub checks failing on a pull request from a fork · GitHub checks skipped by [skip ci] in a commit message · GitHub checks gone after the retention period · GitHub code review limits in a public repository · GitHub pull requests turned off or limited in a repository · GitHub checks run on every pull request in a stack · GitHub pull request showing commits already squash merged · GitHub pull request not showing a file diff · GitHub push to a pull request branch from a fork refused · GitHub check cancelled on a pull request · GitHub Rebase and merge not available · GitHub merge commit message not what you expected · GitHub pull request shows every line changed · GitHub API request timed out · GitHub pull request image or document diff not shown · GitHub review request refused (422) · GitHub pull request from Copilot: checks not running, approval not counted · GitHub push refused: GH006 and GH013 on a protected branch · GitHub "At least 1 approving review is required", approvals that do not count · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語