Specify who can force push to a repository

December 21, 2021

Instead of allowing all or no users to force push, admins can now be selective about who can force push to a repository.

The image below shows how in the past, admins could use a branch protection rule to allow force pushes for everyone or no one, including admins:

Branch protection rule to allow everyone or no one to force push

This all-or-nothing approach didn't support limiting force pushes to select users or teams of an admin's choosing. For example, you might have wanted to allow only a few people to force push, or you had an automated process that solely needed to force push.

Now, you can be specific about the people and teams who are allowed to force push. As shown in the image below, select Allow force pushes and Specify who can force push. Then, search for and select the people and teams who should be allowed to force push.

Branch protection rule to allow everyone, no one, or select users or teams to force push

For more information, visit Managing a branch protection rule.