Lesstep
Forgejo · Gitea · Codeberg · update branch API · Checked October 24, 2026

Forgejo and Gitea: why the branch update was refused

"Update branch" (POST /api/v1/repos/OWNER/REPO/pulls/NUMBER/update, by merge, or with ?style=rebase by rebase) brings the target branch's new commits into the pull request's branch. All of this is from the source of both (UpdatePullRequest in routers/api/v1/repo/pull.go and services/pull/update.go), read on October 24, 2026, including the Gitea releases where it changed.

The answers

A token that may only read is refused with 403 too, but that answer says token does not have at least one of required scope(s); see which permission to add. A pull request number that does not exist answers 404; see missing, private or renamed.

Who may update, and how

By merge (the default), the server lets you update when either holds:

Gitea 1.27 and later also need the target repository's setting Enable updating pull request branch by merge.

By rebase, the update is refused when:

A pull request made with AGit (pushed to refs/for/… instead of from a branch) cannot be updated this way: 403.

Where it stands

curl -H "Authorization: token your-token" https://codeberg.org/api/v1/repos/OWNER/REPO/pulls/42

When merge_base differs from base.sha, the target branch has commits that the pull request's branch does not. allow_maintainer_edit says whether its author allowed edits from maintainers. Use your own server's address instead of codeberg.org.

What to do

Forgejo and Gitea pull requests in IntelliJ IDEA

Pull Request Inbox for Forgejo and Gitea, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows among a pull request's merge checks when the target branch has new commits, with a link to update the branch by merge. When the server refuses, it says so: for 403, that your permissions in the repository or its branch protection may not let your account do it; for conflicts, the server's words. From version 1.0.15, when the pull request was closed or merged in the meantime, it says so instead of "%!s(<nil>)", and on Gitea, when there is nothing left to bring in, that the branch already has the target branch's new commits. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).

Forgejo, Gitea and Codeberg are names of their respective owners; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by the Forgejo project, Codeberg e.V., the Gitea project or JetBrains.

More: Forgejo and Gitea merge refused (405, 409) · Forgejo and Gitea merge when checks succeed refused (405, 409, 500) · Forgejo and Gitea review refused (422) · "token does not have at least one of required scope(s)" · 401 "token is required" and unknown tokens · 404 "The target couldn't be found." and "not found" · Forgejo and Gitea pull request not created (409, 422, 403) · Forgejo and Gitea comment refused (403, 422, 400) · Forgejo and Gitea search refused (400, 422) · Forgejo and Gitea pull request files (pages of 50, changed_files) · Forgejo and Gitea pull request plugins for IntelliJ IDEA, compared · 日本語