• git 提交 “push rejected”,如何解决


    某次intellj idea提交git总是失败。问别人又是很羞耻的事情。

    我已经我代码重新pull下来,再把改动的文件一一添加上去了。完全没有冲突的问题。但是就是不行。

    幸亏一个同事给指导了以下。

    在项目目录下面右键“git Bash here”

    输入命令:

    $ git pull
    Already up to date.

    lunmei@DESKTOP-5COD9DQ MINGW64 /f/workspace2/translation (master)
    $ git pull origin master
    From http://192.168.1.50/project/translation
    * branch master -> FETCH_HEAD
    Already up to date.

    lunmei@DESKTOP-5COD9DQ MINGW64 /f/workspace2/translation (master)
    $ git pull origin master --allow-unrelated-histories
    From http://192.168.1.50/project/translation
    * branch master -> FETCH_HEAD
    Already up to date.

    lunmei@DESKTOP-5COD9DQ MINGW64 /f/workspace2/translation (master)
    $ ^C

    lunmei@DESKTOP-5COD9DQ MINGW64 /f/workspace2/translation (master)
    $ git status
    On branch master
    Your branch is ahead of 'origin/master' by 2 commits.
    (use "git push" to publish your local commits)

    nothing to commit, working tree clean

    lunmei@DESKTOP-5COD9DQ MINGW64 /f/workspace2/translation (master)
    $ git push
    Enumerating objects: 114, done.
    Counting objects: 100% (114/114), done.
    Delta compression using up to 12 threads.
    Compressing objects: 100% (62/62), done.
    Writing objects: 100% (84/84), 16.57 KiB | 1.38 MiB/s, done.
    Total 84 (delta 16), reused 0 (delta 0)
    remote: GitLab: You are not allowed to push code to protected branches on this p roject.
    To http://192.168.1.50/hlhlo/translation.git
    ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'http://192.168.1.50/project/translation.git'


    发现错误的原因是没有给我分配相应的权限。master分支收到保护。只有主程序员和拥有者可以提交代码。而其他身份,比如开发人员就没这个权限。经理把权限改回来,就没问题了。
    ————————————————
    版权声明:本文为CSDN博主「我爱圆溜溜」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/fulq1234/article/details/82887677

  • 相关阅读:
    centos
    ssh 登录 centos 服务器
    Sql NoSql
    Java
    PHP
    React Hooks使用
    前端优化tips
    Error:Node Sass version 5.0.0 is incompatible with ^4.x 解决
    css换行
    git 关联多个远程仓库
  • 原文地址:https://www.cnblogs.com/lijinchang/p/11432931.html
Copyright © 2020-2023  润新知