某次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