折腾:
【未解决】Win10中上线对接iOS自动抓包工具
期间,去git push,但是报错:
(venv) ✘ crifanli@crifanlideMac ~/dev/DevRoot/appcrawler master ● git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean (venv) crifanli@crifanlideMac ~/dev/DevRoot/appcrawler master git pull Already up to date. (venv) crifanli@crifanlideMac ~/dev/DevRoot/appcrawler master git push Enumerating objects: 15, done. Counting objects: 100% (15/15), done. Delta compression using up to 3 threads Compressing objects: 100% (8/8), done. Writing objects: 100% (8/8), 1.55 KiB | 1.55 MiB/s, done. Total 8 (delta 6), reused 0 (delta 0) remote: GitLab: You are not allowed to push code to protected branches on this project. To http://xxx:12310/data_xxx/appcrawler.git/ ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://xxx:12310/data_xxx/appcrawler.git/'
还是先去解决这个问题
后续是用户账号问题?
背景是之前换过git仓库地址
但是之前是可以正常commit的啊
为何现在不行了?
去看了看,此处自己是Developer
不知道是否和此问题有关
remote: GitLab: You are not allowed to push code to protected branches on this project
去看看
此处master是默认protected的
自己没有相关的
scroll down to “Protected branches”
估计是没有权限?
还是让同事把我设置为Owner比较好
然后改为了Owner
然后再去push代码
即可正常上传代码。
【总结】
Gitlab,默认git仓库的默认的master主分支是protected,目的是防止别人破坏。
导致现在自己是仓库Developer成员,无法直接push到master分支。
解决办法:
- 得到push权限
- 2种方法
- 让有权限的人把你权限改为更高的,比如Owner
- 让有权限得人,把master的push的所允许的人中,加上你
- Settings-》Repository -》Protected Branches-》Allowed to push中加上对应权限的人
- 比如:
- 允许Developer+Maintainers去push到protected branch(此处的master分支)
- 建其他分支,再合并到master分支
- 新建另外的分支,比如develop
- 每次代码提交到develop
- 然后通过提交merge request把改动合并到master
- 注:需要有权限的人去处理merge request
- 相对比较麻烦,但是更安全
转载请注明:在路上 » 【已解决】git上传代码报错:remote GitLab You are not allowed to push code to protected branches on this project