Skip to content

Commit to protected branch is ignored. #4444

Closed

Description

@workobots

Description

Even though the master branch is protected, it's possible to commit to this branch (not push though), and this makes a mess and it's quite annoying to fix.

It would be great if commits to protected branches are restricted according to the users permissions, just as it happens in github web. image

Version

  • GitHub Desktop: 1.1.1
  • Operating system: Microsoft Windows [Version 10.0.16299.125]

Steps to Reproduce

  1. Set branch protection for master in repository settings/branches and enable:
    • Protect this branch.
    • Restrict who can push to this branch.
  2. Login to Github desktop with a user that has no push permissions to the master branch.
  3. Add new file and commit to master branch.

Expected Behavior

Warning message or disabled commit button when trying to commit to a restricted branch.
If it's a warning message, please make it a bit friendlier with a message like "You can’t commit to master because it is a protected branch."

Actual Behavior

  1. The commit is made to the master branch even though I have no permissions for this branch.
  2. The push is not permitted and now I'm aware I'm working in the wrong. Oops.
  3. I switch or create new branch but now I have no changes to commit :( and know I don't know what to do.

Additional Information

Logs

Activity

  1. shiftkey commented on Apr 15, 2018

    @shiftkey
    Member

    @workobots thanks for the feedback. I'm going to merge this into #3633 which is an earlier issue but focused on merging branches rather than committing directly - it's the same underlying issue.

  2. locked as resolved and limited conversation to collaborators on Jul 17, 2018
  3. unlocked this conversation on Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions