git 提交代码remote: error:updating the current branch in a non-bare repository is denied
2017-07-30 13:11
627 查看
问题:
开发机提交代码到远程仓库时,出错如下错误:$ git push origin master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 267 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (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 inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match 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@192.168.12.70:/data/orange ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to 'git@192.168.12.70:/data/orange'
解决办法:
在服务器端仓库目录下$ cd /data/orange $ git config receive.denyCurrentBranch warn
更好的办法:
error信息中已经给出提示:
“By default, updating the current branch in a non-bare repository is denied,”
服务器上配置代码仓库时,将代码库初始化为裸仓库,即使用命令:
$ git init --bare
这样,其他机器提交代码就不会有问题。
相关文章推荐
- git push时错误提示的解决办法 By default, updating the current branch in a non-bare repository error: is denied,
- git:解决The current branch is not configured for pull No value for key branch.master.merge found in config
- Sharepoint Error : The URL "filename" is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web
- Git提交问题:remote: ERROR: missing Change-Id in commit message footer
- 解决Git报错:The current branch is not configured for pull No value for key branch.master.merge found in configuration
- git error:Updates were rejected because the tip of your current branch is behind
- 【git】updates were rejected because the tip of your current branch is behind its remote counterpart
- The current branch is not configured for pull No value for key remote.origin.url found in configurat
- How to delete the remote branch in git
- git 提交代码 ERROR: [eaabb6d] missing Change-Id in commit message footer
- git 出现 The current branch is not configured for pull No value for key branch.master.merge found in configuration
- git 解决The current branch is not configured for pull No value for key branch.master.merge found in co
- git 出现The current branch is not configured for pull No value for key branch.master.merge found in configuration错误的解决办法
- Git- [!remote rejected]:refusing to delete the current branch
- Git提交代码push的时候报错:HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
- (git问题)解决The current branch is not configured for pull No value for key remote.origin
- 【问题处理】GIT删除主分支报错:[remote rejected] master (deletion of the current branch prohibited)
- 提交项目到git远程仓库报错:error occurred during unpacking on the remote end: error Missing blob 261c12f4b8e2f5a
- [置顶] 【JAVA】Eclipse中使用git进行pull远程代码,报错The current branch is not configured for pull No value for key branc
- git 无法提交报错 - error: The requested URL returned error: 403 Forbidden while accessing https://github.c