centos5 git共享文件夹

时间:2011-08-04 12:17:37

标签: git centos5 gitolite

我是git的新手,我遇到了问题 我在我的git系统上推送数据时遇到了问题。 我安装了git和gitolite但是当我打电话:“git push origin master”它给了我这个错误:

Counting objects: 12, done.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (12/12), 1.47 KiB, done.
Total 12 (delta 1), reused 5 (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 gitolite@server.nl:gitolite-admin
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'gitolite@server.nl:gitolite-admin'

我按照本教程安装了gitolite:gitolink 一切顺利,但最后一步。当我执行命令时,我遗憾地得到了这个错误

任何人都可以告诉我该怎么做或如何解决这个问题? 已经被诅咒: git config --bool core.bare是的 更改分支(以便它(主)不使用)

1 个答案:

答案 0 :(得分:0)

基本问题是您正在尝试推送到“非裸”git存储库。虽然这是可能的,但很多文档和书籍都没有明确表示不建议这样做。

因此,虽然git是一个分散的/多主的scm,但实际上你所拥有的是“主”或“中央”存储库,你可以从克隆并将推送到并作为“规范”回购,以及您从“强大”克隆的工作回购(例如在您的笔记本电脑上),您将拉到并从推送。应使用--bare:

创建这些“主”存储库
server$ cd ; mkdir git
server$ git clone --bare /home/user/foo /home/user/git/foo.git

完成此操作后,您就可以从笔记本电脑上推送:

laptop$ cd foo
laptop$ git remote -v
laptop$ origin user@server:/home/user/git/foo.git (fetch)
laptop$ origin user@server:/home/user/git/foo.git (push)
laptop$ git push origin master

您也可以在服务器上执行此操作:

git config --global receive.denyCurrentBranch "ignore"

但是在你更好地理解git是如何工作之前我不会这样做。