簡體   English   中英

無法在 Gitlab 中的此項目中創建受保護的分支

[英]Can not create protected branch in this project in Gitlab

我在 gitlab 有一個項目。 我的同事在那里有維護者身份。 我有開發者身份。 他讓我用一個新的分支在那里推送一個文件。 然后合並請求,以便他可以檢查並接受。 但是當我推送時,我收到以下錯誤:

remote: GitLab: You are not allowed to create protected branches on this project.

To ".../..../myProject"

! [remote rejected] myBranch -> myBranch (pre-receive hook declined)

error: failed to push some refs to '.../..../myProject'



Here's what I did:
git clone .... // cloned the project as there were already files

// then added my files to the cloned project, created a new branch and did add

    git add.
    
    git commit -m "..."
    
    git push origin myBranch

如果我沒記錯的話,問題是默認情況下 GitLab 只允許維護者創建新的受保護分支。

因此,這可能與 repo 中的權限有關,如果您在受保護的分支保護中使用通配符,則應檢查 GitLab。

您的項目是這樣設置的,因此您不能直接使用 git,而是通過分叉。 這也是 GitHub 的設置方式。

通過單擊分叉按鈕將 git 分叉到您的空間中:

在此處輸入圖像描述

之后就可以checkout你的fork,也可以創建自己的branch等等。當你需要創建merge request時,需要在原git中點擊New merge request

在此處輸入圖像描述

然后 select 您的 git 和分支,以及原始 git 和它的目標分支。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM