How to make commits on protected branch in git?











up vote
0
down vote

favorite












My master branch in protected.



Just I want to make small(One line changes) commit on master.



I don't want to make a new branch and merge with master.



But i'm getting messages while push code on master:



remote: GitLab: You are not allowed to push code to protected branches on this project.
To https://gitlab.com/xyz/api_xyz.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/xyz/api_xyz.git'


Is it permission problem?



Can I make a commit to the protected branch?










share|improve this question




















  • 1




    Hi. Do you know what "protected branch" means?
    – Lasse Vågsæther Karlsen
    Nov 22 at 7:44















up vote
0
down vote

favorite












My master branch in protected.



Just I want to make small(One line changes) commit on master.



I don't want to make a new branch and merge with master.



But i'm getting messages while push code on master:



remote: GitLab: You are not allowed to push code to protected branches on this project.
To https://gitlab.com/xyz/api_xyz.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/xyz/api_xyz.git'


Is it permission problem?



Can I make a commit to the protected branch?










share|improve this question




















  • 1




    Hi. Do you know what "protected branch" means?
    – Lasse Vågsæther Karlsen
    Nov 22 at 7:44













up vote
0
down vote

favorite









up vote
0
down vote

favorite











My master branch in protected.



Just I want to make small(One line changes) commit on master.



I don't want to make a new branch and merge with master.



But i'm getting messages while push code on master:



remote: GitLab: You are not allowed to push code to protected branches on this project.
To https://gitlab.com/xyz/api_xyz.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/xyz/api_xyz.git'


Is it permission problem?



Can I make a commit to the protected branch?










share|improve this question















My master branch in protected.



Just I want to make small(One line changes) commit on master.



I don't want to make a new branch and merge with master.



But i'm getting messages while push code on master:



remote: GitLab: You are not allowed to push code to protected branches on this project.
To https://gitlab.com/xyz/api_xyz.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/xyz/api_xyz.git'


Is it permission problem?



Can I make a commit to the protected branch?







git gitlab






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked Nov 22 at 7:27









Mr Singh

932422




932422








  • 1




    Hi. Do you know what "protected branch" means?
    – Lasse Vågsæther Karlsen
    Nov 22 at 7:44














  • 1




    Hi. Do you know what "protected branch" means?
    – Lasse Vågsæther Karlsen
    Nov 22 at 7:44








1




1




Hi. Do you know what "protected branch" means?
– Lasse Vågsæther Karlsen
Nov 22 at 7:44




Hi. Do you know what "protected branch" means?
– Lasse Vågsæther Karlsen
Nov 22 at 7:44












3 Answers
3






active

oldest

votes

















up vote
1
down vote













You can commit locally, but, by default, no one (with exceptions, see link below) is allowed to push to a protected branch. You can change this default behavior in the settings; see gitlab documentation:



Since GitLab 8.11, you can define which roles are allowed to push to a protected branch via Settings->Repositories->Protected Branches:
enter image description here



Alas, you should not carelessly commit and push to protected branches; they're mostly protected for a reason. Why not just create a merge request and lat your code be reviewed before it is merged?!






share|improve this answer




























    up vote
    0
    down vote













    In Gitlab only the project master can allow you to push in master, developpers have to issue merge request.



    Go to Settings > Repository to change permissions or ask your project master to do it.






    share|improve this answer




























      up vote
      0
      down vote













      From the docs: https://docs.gitlab.com/ee/user/permissions.html



      Only Maintainer or Owner have "Push to protected branches" permission.



      To protect a branch, you need to have at least Maintainer/Owner permission level. Note that the master branch is protected by default.




      Configuring protected branches To protect a branch, you need to have
      at least Maintainer permission level. Note that the master branch is
      protected by default.




      1. Navigate to your project’s Settings ➔ Repository

      2. Scroll to find the Protected branches section.

      3. From the Branch dropdown menu, select the branch you want to protect and click Protect. In the screenshot below, we chose the
        develop branch.







      share|improve this answer





















        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53425832%2fhow-to-make-commits-on-protected-branch-in-git%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        down vote













        You can commit locally, but, by default, no one (with exceptions, see link below) is allowed to push to a protected branch. You can change this default behavior in the settings; see gitlab documentation:



        Since GitLab 8.11, you can define which roles are allowed to push to a protected branch via Settings->Repositories->Protected Branches:
        enter image description here



        Alas, you should not carelessly commit and push to protected branches; they're mostly protected for a reason. Why not just create a merge request and lat your code be reviewed before it is merged?!






        share|improve this answer

























          up vote
          1
          down vote













          You can commit locally, but, by default, no one (with exceptions, see link below) is allowed to push to a protected branch. You can change this default behavior in the settings; see gitlab documentation:



          Since GitLab 8.11, you can define which roles are allowed to push to a protected branch via Settings->Repositories->Protected Branches:
          enter image description here



          Alas, you should not carelessly commit and push to protected branches; they're mostly protected for a reason. Why not just create a merge request and lat your code be reviewed before it is merged?!






          share|improve this answer























            up vote
            1
            down vote










            up vote
            1
            down vote









            You can commit locally, but, by default, no one (with exceptions, see link below) is allowed to push to a protected branch. You can change this default behavior in the settings; see gitlab documentation:



            Since GitLab 8.11, you can define which roles are allowed to push to a protected branch via Settings->Repositories->Protected Branches:
            enter image description here



            Alas, you should not carelessly commit and push to protected branches; they're mostly protected for a reason. Why not just create a merge request and lat your code be reviewed before it is merged?!






            share|improve this answer












            You can commit locally, but, by default, no one (with exceptions, see link below) is allowed to push to a protected branch. You can change this default behavior in the settings; see gitlab documentation:



            Since GitLab 8.11, you can define which roles are allowed to push to a protected branch via Settings->Repositories->Protected Branches:
            enter image description here



            Alas, you should not carelessly commit and push to protected branches; they're mostly protected for a reason. Why not just create a merge request and lat your code be reviewed before it is merged?!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 at 7:37









            kowsky

            2,9271223




            2,9271223
























                up vote
                0
                down vote













                In Gitlab only the project master can allow you to push in master, developpers have to issue merge request.



                Go to Settings > Repository to change permissions or ask your project master to do it.






                share|improve this answer

























                  up vote
                  0
                  down vote













                  In Gitlab only the project master can allow you to push in master, developpers have to issue merge request.



                  Go to Settings > Repository to change permissions or ask your project master to do it.






                  share|improve this answer























                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    In Gitlab only the project master can allow you to push in master, developpers have to issue merge request.



                    Go to Settings > Repository to change permissions or ask your project master to do it.






                    share|improve this answer












                    In Gitlab only the project master can allow you to push in master, developpers have to issue merge request.



                    Go to Settings > Repository to change permissions or ask your project master to do it.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 22 at 7:36









                    MathWellan

                    66




                    66






















                        up vote
                        0
                        down vote













                        From the docs: https://docs.gitlab.com/ee/user/permissions.html



                        Only Maintainer or Owner have "Push to protected branches" permission.



                        To protect a branch, you need to have at least Maintainer/Owner permission level. Note that the master branch is protected by default.




                        Configuring protected branches To protect a branch, you need to have
                        at least Maintainer permission level. Note that the master branch is
                        protected by default.




                        1. Navigate to your project’s Settings ➔ Repository

                        2. Scroll to find the Protected branches section.

                        3. From the Branch dropdown menu, select the branch you want to protect and click Protect. In the screenshot below, we chose the
                          develop branch.







                        share|improve this answer

























                          up vote
                          0
                          down vote













                          From the docs: https://docs.gitlab.com/ee/user/permissions.html



                          Only Maintainer or Owner have "Push to protected branches" permission.



                          To protect a branch, you need to have at least Maintainer/Owner permission level. Note that the master branch is protected by default.




                          Configuring protected branches To protect a branch, you need to have
                          at least Maintainer permission level. Note that the master branch is
                          protected by default.




                          1. Navigate to your project’s Settings ➔ Repository

                          2. Scroll to find the Protected branches section.

                          3. From the Branch dropdown menu, select the branch you want to protect and click Protect. In the screenshot below, we chose the
                            develop branch.







                          share|improve this answer























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            From the docs: https://docs.gitlab.com/ee/user/permissions.html



                            Only Maintainer or Owner have "Push to protected branches" permission.



                            To protect a branch, you need to have at least Maintainer/Owner permission level. Note that the master branch is protected by default.




                            Configuring protected branches To protect a branch, you need to have
                            at least Maintainer permission level. Note that the master branch is
                            protected by default.




                            1. Navigate to your project’s Settings ➔ Repository

                            2. Scroll to find the Protected branches section.

                            3. From the Branch dropdown menu, select the branch you want to protect and click Protect. In the screenshot below, we chose the
                              develop branch.







                            share|improve this answer












                            From the docs: https://docs.gitlab.com/ee/user/permissions.html



                            Only Maintainer or Owner have "Push to protected branches" permission.



                            To protect a branch, you need to have at least Maintainer/Owner permission level. Note that the master branch is protected by default.




                            Configuring protected branches To protect a branch, you need to have
                            at least Maintainer permission level. Note that the master branch is
                            protected by default.




                            1. Navigate to your project’s Settings ➔ Repository

                            2. Scroll to find the Protected branches section.

                            3. From the Branch dropdown menu, select the branch you want to protect and click Protect. In the screenshot below, we chose the
                              develop branch.








                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 22 at 7:42









                            huytmb

                            824




                            824






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53425832%2fhow-to-make-commits-on-protected-branch-in-git%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                What visual should I use to simply compare current year value vs last year in Power BI desktop

                                How to ignore python UserWarning in pytest?

                                Alexandru Averescu