centos5 git 共享文件夹
我是 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 [email protected]:gitolite-admin
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '[email protected]:gitolite-admin'
我按照本教程安装 gitolite: gitolink 一切都按我应该的方式进行,但在最后一步。当我执行命令时,我遗憾地收到此错误,
任何人都可以告诉我该怎么做或如何解决此问题? 已经试过了: git config --bool core.bare true 更改分支(以便它(master)不被使用)
i'm new to git and i'm having a problem
i have a problem at pushing data at my git system.
i installed git and gitolite but when i call: "git push origin master" it gives me this error:
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 [email protected]:gitolite-admin
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '[email protected]:gitolite-admin'
i followed this tutorial installing gitolite: gitolink
everything worked as i should be but at the very last step. When i execute the command i sadly got this error
can anyone tell me what to do or how to fix this?
already thried :
git config --bool core.bare true
changing the branch (so that it(master) isn't in use)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本问题是您正在尝试推送到“非裸”git 存储库。虽然这是可能的,但许多文档和书籍并没有明确表明不建议这样做。
因此,虽然 git 是一个去中心化/多主 scm,但在实践中,您往往拥有的是“主”或“中央”存储库,您可以从这些存储库中克隆并推送到这些存储库,然后充当“规范”存储库,以及从“主库”克隆的工作存储库(例如在您的笔记本电脑上),您可以向拉取并从中推送。这些“主”存储库应该使用 --bare 创建:
完成此操作后,您将能够从笔记本电脑上推送:
您也可以在服务器上执行此操作:
但在您更好地理解之前我不会这样做git 是如何工作的。
The basic problem is that you're trying to push to a "none-bare" git repository. Whilst this is possible, a lot of the documentation and books don't make it clear that this isn't recommended.
So while git is a decentralised/many-master scm, in practice what you tend to have is "master" or "central" repositories that you clone from and push to and serve as the "canonical" repo, and work repos (eg on your laptop) that you cloned from a "master" that you pull to and push from. These "master" repositories should be created with --bare:
Once you've done this, you'll be able to push from your laptop:
You could also do on the server:
But I wouldn't do this until you understand better how git works.