Improve the "You are not allowed to push into this branch" error message

Summary

When a user attempts to push changes into a branch that they don't have permissions for, they get a generic You are not allowed to push into this branch error. The error can be made more useful for the user by providing alternative actions they can take to proceed with their task.

I initially looked at improving a buggy error in the Metrics dashboard when a user with developer access attempts to duplicate a dashboard and save it to master. However, a similar error appears in other places within GitLab, and could also be improved.

The error in metrics The error in file editor
image error

Proposal

I suggest to update the error to make it more actionable for the user, and thus more useful. For example, You are not allowed to push into this branch. Create another branch or open a merge request.

Edited by Nadia Sotnikova