Backport #25578 This PR added a repository's check when creating/deleting branches via API. Mirror repository and archive repository cannot do that.