码迷,mamicode.com
首页 > 其他好文 > 详细

git版本管理工具push失败解决方案参考

时间:2015-05-28 18:23:07      阅读:875      评论:0      收藏:0      [点我收藏+]

标签:git push error branch currently master git推送失败 sourcetree

git clone xxx@xx 版本后,edit某文件,commit之后,点push,提示报错。

可能有以下原因:

1、权限不够,远程仓库的文件夹(比如/home/git)下面的文件所属用户非git用户,而默认的文件权限通常是644,那么当你用非git用户push的时候,肯定是权限不够的。

解决方法:进入远程仓库的上一级,查看git目录下所有文件的权限,比如:

cd /home/git
ls -al

更改git目下所有文件目录的文件主为git:

chown -R git.git /home/git/*

2、如果报错提示如下:

  git push 
  hap@192.168.1.2‘s password: 
  Counting objects: 21, done.
  Compressing objects: 100% (11/11), done.
  Writing objects: 100% (11/11), 1010 bytes, done.
  Total 11 (delta 9), reused 0 (delta 0)
  error: refusing to update checked out branch: refs/heads/master
  error: By default, updating the current branch in a non-bare repository
  error: is denied, because it will make the index and work tree inconsistent
  error: with what you pushed, and will require ‘git reset --hard‘ to match
  error: the work tree to HEAD.
  error: 
  error: You can set ‘receive.denyCurrentBranch‘ configuration variable to
  error: ‘ignore‘ or ‘warn‘ in the remote repository to allow pushing into
  error: its current branch; however, this is not recommended unless you
  error: arranged to update its work tree to match what you pushed in some
  error: other way.
  error: 
  error: To squelch this message and still keep the default behaviour, set
  error: ‘receive.denyCurrentBranch‘ configuration variable to ‘refuse‘.
  To git+ssh://hap@192.168.1.2/media/LINUXDATA/working
  ! [remote rejected] master -> master (branch is currently checked out)

则进入远程仓库 

    

cd /home/git/ssm.git

再执行如下命令

git config ‘receive.denyCurrentBranch‘ warn


git版本管理工具push失败解决方案参考

标签:git push error branch currently master git推送失败 sourcetree

原文地址:http://stoffsky.blog.51cto.com/3025834/1656000

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!