git pull出错处理

使用git pull时,由于没有设置原仓库的权限导致如下信息报错: 


 git config --global push.default matching



若要不再显示本信息并从现在开始采用新的使用习惯,设置:


  git config --global push.default simple


当 push.default 设置为 'matching' 后,git 将推送和远程同名的所有
本地分支。


从 Git 2.0 开始,Git 缺省采用更为保守的 'simple' 模式,只推送当前
分支到远程关联的同名分支,即 'git push' 推送当前分支。


参见 'git help config' 并查找 'push.default' 以获取更多信息。
('simple' 模式由 Git 1.7.11 版本引入。如果您有时要使用老版本的 Git,
为保持兼容,请用 'current' 代替 'simple')


Counting objects: 39, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 366.95 KiB | 96.00 KiB/s, done.
Total 21 (delta 16), 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 /home/xb/ite_win/project/q1_mh/.git
 ! [remote rejected] master -> master (branch is currently checked out)

error: 无法推送一些引用到 '/home/xb/ite_win/project/q1_mh/.git'


在原仓库使用 

git config receive.denyCurrentBranch ignore

解决此问题。 

也可直接更改 .git/config

 [receive]                      
    denyCurrentBranch = ignore  

可以得到同样的效果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值