无法推入到git存储库中 [英] cannot push into git repository

查看:124
本文介绍了无法推入到git存储库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我迄今为止所做的工作,我会说这个过程在Ubuntu 9.10上工作过,它可能有不同版本的git。

  server:mkdir〜/ git 

local:scp -r /../project name@url.com:〜/ git /
server:cd git
cd项目
git init
git add。
git commit -a -minitial

local:git clone name@url.com:/../ git / project / home / name / project
cd项目
capify。 (来自ruby gem capistrano)
git add。
git commit -a -mcapified
git push

当我尝试推出这个我得到这个错误信息:

$ p $ 远程:错误:拒绝更新检出分支:refs / heads / master
remote:error:默认情况下,更新非裸仓库中的当前分支
remote:error:被拒绝,因为它会使索引和工作树不一致
remote:error :与您推送的内容相同,并且需要'git reset --hard'来匹配
remote:error:工作树到HEAD。
remote:错误:
remote:错误:您可以在远程存储库中将'receive.denyCurrentBranch'配置变量设置为
remote:error:'ignore'或'warn',以允许推入
remote:错误:当前分支;然而,除非你
remote:error:安排它更新它的工作树来匹配你在
remote:error:other方面推送的内容,否则不建议这样做。
remote:error:
remote:error:为了压制此消息并保持默认行为,请将
remote:error:'receive.denyCurrentBranch'配置变量设置为'拒绝'。
要...
! [remote rejected] master - > master(分支目前已检出)
错误:无法将某些参考推送至


解决方案

在服务器端,执行此操作:

  git config receive.denyCurrentBranch忽略

然后你可以在当地推。


This is what I have done so far and I will say this procedure worked on Ubuntu 9.10 which perhaps had a different version of git.

server: mkdir ~/git

local: scp -r /../project name@url.com:~/git/
server: cd git
        cd project
        git init 
        git add .
        git commit -a -m "initial"

local: git clone name@url.com:/../git/project /home/name/project
   cd project
   capify .  (from the ruby gem capistrano)
   git add .
   git commit -a -m "capified"
   git push

When I try to push this out I get this error message:

   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 ...
   ! [remote rejected] master -> master (branch is currently checked out)
   error: failed to push some refs to

解决方案

At server side, do this:

git config receive.denyCurrentBranch ignore

Then you can push at local.

这篇关于无法推入到git存储库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆