首页 > 解决方案 > 您不允许将代码推送到此项目的受保护分支。?

问题描述

当我将代码推送到 gitlab 时,它会出现这种错误,因为我是 git 新手。请指导我!

$ git push origin master                                                                                                Counting objects: 71, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (71/71), 9.93 KiB | 0 bytes/s, done.
Total 71 (delta 23), reused 0 (delta 0)
remote: GitLab: You are not allowed to push code to protected branches on this project.To https://gitlab.com/akash/demo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/akash/demo.git'

标签: gitgithubgitlab

解决方案


受保护的分支就是它听起来的样子。似乎您不是分支的所有者,因为所有者选择让您无法将更改推送到分支中,老实说 - 您对此无能为力。

如果您所有者并且它以某种方式发生,则可以通过单击存储库中 master 分支旁边的Unprotect按钮轻松修复它。


推荐阅读