欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

程序员文章站 2022-04-08 23:35:18
今天在使用Git回退到之前某个版本的代码时,进行push时出现如下错误: ! [remote rejected] master -> master (pre-receive hook declined)...... 查阅相关资料发现,是由于当前用户没有push权限,就是[master]代码默认是被保 ......

今天在使用git回退到之前某个版本的代码时,进行push时出现如下错误:

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

Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

查阅相关资料发现,是由于当前用户没有push权限,就是[master]代码默认是被保护的,所以进行push的时候会报错;

解决方案:

登录gitlab,选择对应的项目,点击[setting],

Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

选择[protected branches];

Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

解除[master]的保护即可;

Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

push完代码之后,再把[master]protect起来即可;

Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......