Azure DevOps: "TF402455: Pushes to this branch are not permitted; you must use a pull request to update this branch."
The branch has a required branch policy, so Azure Repos takes changes to it only through pull requests. The push was refused, the branch on the server did not change, and your commits are still in your local branch. Put them on a new branch, push that, and open a pull request into this one.
The whole message
git prints the refusal like this. The text in brackets comes from Azure DevOps, as public bug reports from 2018 to 2023 show it; the rest is git's own.
! [remote rejected] main -> main (TF402455: Pushes to this branch are not permitted; you must use a pull request to update this branch.) error: failed to push some refs to 'https://dev.azure.com/<organization>/<project>/_git/<repository>'
It is not a sign-in problem. Azure DevOps accepted who you are and refused because of the branch's policy, so a new token or password for the same account will not help.
To move your commits to a pull request without the browser: Azure DevOps Pull Requests, a plugin for JetBrains IDEs, opens a pull request from the branch you are on, and opens the IDE's push dialog first when the branch is not on Azure DevOps yet.
Why Azure Repos refuses
From Microsoft's page on branch policies (Set and manage branch policies):
- You can't push directly to a branch with a required branch policy unless you have permission to bypass branch policies. Changes reach it only through pull requests.
- A branch with only optional policies still takes direct pushes.
- A branch with required policies cannot be deleted either.
Move your commits to a pull request
# 1. Put your commits on a new branch (you stay on them) git switch -c my-change # 2. Push the new branch git push -u origin my-change # 3. Set your local main back to where the server has it git branch -f main origin/main
We ran these against a local git server that refuses pushes to main: the commits ended up on my-change on the server, and the local main matched origin/main again. Do step 3 only after step 2 succeeded. With Git older than 2.23, use git checkout -b my-change for step 1.
Then open the pull request from my-change into main:
- On the web: Repos → Pull requests → New pull request. After you push a branch, Azure Repos also offers Create a pull request on the Pull requests and Files pages, and on Azure DevOps Services the
git pushoutput can include a direct link. - With the Azure DevOps CLI (the
azure-devopsextension; Azure DevOps Services only):az repos pr create --source-branch my-change --title "My change" --open. Without--target-branch, it targets the repository's default branch.
When a pipeline pushes
A pipeline that commits back to the branch, such as a version bump or a changelog, gets the same refusal. Either have it push a branch and open a pull request, or give the identity it runs as Bypass policies when pushing. Microsoft lets you grant that permission for a whole project, one repository or a single branch, and asks for caution with it, so grant it on that one branch only.
In the wiki: "Pushes to this branch is not permitted. Please continue with 'Edit in Repos'"
The wiki editor shows the same refusal in other words: "Pushes to this branch is not permitted. Please continue with 'Edit in Repos' and use a pull request to update this branch." (one such report on Microsoft Q&A). A wiki is a Git repository, and its branch has a branch policy:
- A code wiki, published from a repository: the published branch has branch policies. Select Edit → Edit in Repos, which creates a branch to edit on, then open a pull request into the published branch. Microsoft offers Edit in Repos only for code wikis with branch policies (Add and edit wiki pages).
- A project wiki: its repository's root branch is
wikiMain, and branch policies set on it apply as on any repository (Wiki file and folder structure in Git). Clone the wiki, push your change to a new branch and open a pull request intowikiMain, or ask a Project Administrator to take the policy offwikiMain.
Create Azure DevOps pull requests from IntelliJ IDEA and Rider
Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, adds Git → Create Azure DevOps Pull Request…. It opens a pull request from the branch you are on, into the repository's default branch unless you pick another, optionally as a draft. If the branch is not on Azure DevOps yet, it says so and opens the IDE's push dialog first. Creating pull requests is Pro (US$1 a month, with a 30-day free trial); the review inbox is free.
Get it on JetBrains Marketplace
Azure DevOps and Azure Repos are trademarks of Microsoft Corporation; IntelliJ IDEA and Rider are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.
More: "VS403654: The push was rejected because it contains one or more secrets" · Azure DevOps plugins for IntelliJ IDEA 2025.2 and later · 日本語