[github/gitlab] 遠端倉庫master分支無法清除問題
阿新 • • 發佈:2020-12-28
技術標籤:gitTranswarpgitgitlabgithub
[github/gitlab] 遠端倉庫master分支無法清除問題
1. 問題情況
在近日的專案開發過程中,由於之前在master分支上提交了無用的commit到遠端分支,於是想清空遠端的master分支,提交合並多個commit後的唯一commit。但是在刪除遠端master分支時候遇到了無法清除的情況,如下圖所示:
remote: GitLab: You can only delete protected branches using the web interface.
To http:/172。*****:****/Mars/auto-benchmark-TST.git
! [remote rejected] master (pre-receive hook declined)
error: 無法推送一些引用到 'http://172.**.**.***:***/Mars/auto-benchmark-TST.git'
2. 解決方法
檢視報錯資訊,無法刪除保護受保護的分支,只能在網頁介面進行刪除, 解決方法如下
- 開啟gitlab,找到自己對應的專案
- 點選左側settings的respository
- 右側的Default Branch的分支選擇其他分支(結束之後可以更改為master)
- 右側Protected Branches 取消master的保護狀態
- 本地刪除遠端master分支即可