gitlab上創建project後,並本地init git project後,嘗試下在第六步push本地project時,若遇到無法push commit至protect branch問題,如 "You are not allowed to force push code to a protected branch on this project.",可通過gitlab project頁面unprotect branch
git init
git add xxx
git commit -m"xxx"
git remote add origin https://gitlab.com/xxx/xxx.git
git branch -M main
git push -uf origin main
unprotect branch方式如下:
1, 選擇settings -> repository
2. 點選欲被push但被protect的branch,後方的unprotect按鈕
3. 點選後即可本地操作重新push,此時應可成功push至原嘗試push的branch
git push -uf origin main
沒有留言:
張貼留言