git push 遭遇拒绝
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
C:\pub\xx.com>git push o2 master git@xxx.com's password: Counting objects: 1297, done. Delta compression using up to 4 threads. Compressing objects: 100% (678/678), done. Writing objects: 100% (728/728), 1.06 MiB, done. Total 728 (delta 525), reused 1 (delta 0) remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the current branch in a non-bare repository remote: error: is denied, because it will make the index and work tree inconsist ent remote: error: with what you pushed, and will require 'git reset --hard' to matc h remote: error: the work tree to HEAD. remote: error: remote: error: You can set 'receive.denyCurrentBranch' configuration variable to remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, set remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. To git@xx.com:/home/git/repo/.git ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to 'git@xxx.com:/home/git/repo/.git' |
错误原因以及解决 这是由于git默认拒绝了push操作,需要进行设置,修改.git/config文件后面添加如下代码: vim /home/git/repo/.git/config
1 2 |
[receive] denyCurrentBranch = ignore |
使用git方式来发布war包,可以自动合并文件的改变,只会提交相关的变更文件,比普通传war包的方式要大大节省时间。
1 2 |
C:\pub\xxx>git remote -v o2 git@xxx.com:/home/git/repo/.git (fetch) |