git使用问题-解决方法 备忘

1-- clone分支,修改文件本地commit后, push回原分支失败,报错:

  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)
  error: failed to push some refs to 'git+ssh://hap@192.168.1.2/media/LINUXDATA/working'


  参照如下链接,目标repo中执行 $ git config 'receive.denyCurrentBranch' warn 后OK

  http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked


2-- 新增文件add commit后,push回原分支失败,报错:

  Counting objects: 20, done.
  Delta compression using up to 24 threads.
  Compressing objects: 100% (11/11), done.
  Writing objects: 100% (11/11), 1.30 KiB, done.
  Total 11 (delta 5), reused 0 (delta 0)
  error:  insufficient permission for adding an object to repository database ./objects


  参照如下链接,查看原repo .git目录权限,发现.git/object/没有group写权限导致;执行 $ sudo chmod g+w -R .git/object 后OK

  http://stackoverflow.com/questions/6448242/git-push-error-insufficient-permission-for-adding-an-object-to-repository-datab

 

3-- git clone/git clone --bare/git clone --mirror 区别

   http://stackoverflow.com/questions/3959924/whats-the-difference-between-git-clone-mirror-and-git-clone-bare



4-- does not appear to be a git repository

     这种问题,权限问题居多,看看整个repo目录 全路径上面用户、组权权限,是否允许访问

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值