拉动工作,推动不工作的1und1 git服务

时间:2013-03-23 18:41:02

标签: git

我正在为他们提供的GIT使用1und1.de服务。现在我正在设置它,然后使用命令git pull ssh:// .........

从那里将更改提取到我的本地计算机

但是当我尝试git push ssh:// ......我收到了很多错误:

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 incosistent

Auto packing the repository for optimum performance.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 arranged to update its work tree to match waht you pushed in some other way.

remote: error: to sqelch this message and still keep the default behaviour, set
remote: error: receive.denyCurrentBranch' configuration variable to 'refuse'.
! [remote_rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://........' 

2 个答案:

答案 0 :(得分:1)

当您设置要推送到的存储库时,请将其设置为bare存储库:

git init --bare

虽然技术上可以推送到具有工作目录的repo,但这太令人头疼了,在这种情况下,你甚至不需要它。

只需将repo重新创建为裸机或从中创建一个裸机(git clone --bare /path/to/repo

答案 1 :(得分:1)

Git存储库有两种类型。 bare 存储库通常称为foo.git,并且没有工作树,只有Git的内部文件。 非裸存储库是一个工作树(即包含所有文件的目录),它还包含名为.git的目录。正如错误消息所解释的那样,推入非裸存储库通常是一个坏主意,因为当您这样做时,工作树会对存储库变得过时。

当您为人们提供存储库并进入其中时,您几乎总是需要一个裸存储库。在这种情况下,您似乎已经创建了一个非裸存储库。由于您没有提供有关如何创建存储库的任何详细信息,因此我无法告诉您错误做了什么,但您可以通过以下两种方式之一创建裸存储库:

  1. 从您要创建存储库的目录中,发出git clone --bare path/to/original.git。这会将源克隆到您所在目录中的裸存储库original.git
  2. 从您要创建存储库的目录中,发出git init --bare foo.git。这将在您所在的目录中创建一个空的裸存储库foo.git
  3. 你可以做更多的事情,但他们最容易做对。在现有存储库中发布git config --set core.bare false将使Git认为从那时起它是一个裸存储库,但您必须自己删除工作树,并且您应该将存储库从.git重命名为{{1} }。

相关问题