Git不会进入服务器上的裸存储库


4

我刚刚在一台服务器上安装了Gitolite,所以我推进的任何存储库都应该是裸存储库,我甚至进入了repo目录,然后运行 git init --bare 在它们中确保它们是裸露的,但是当我尝试将它们推入它们时,我仍然会收到以下错误消息:

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'.

我甚至跑了 git config receive.denyCurrentBranch ignore 尝试让它只是推入远程仓库,但错误仍然出现。

我不确定我在这里做错了什么。


1
检查此链接: bitflop.com/tutorials/git-bare-vs-non-bare-repositories.html - 它解释了裸露和非裸露回购之间的区别。
Meetai.com

更新评论中发布的链接URL bitflop.dk/tutorials/...

Answers:


1

你不应该跑一个 git init --bare 你自己。

只需在中声明一个新的回购名称 gitolite.conf 的文件 gitolite-admin repo,把它推回到gitolite服务器,而gitolite本身将正确创建该repo(in ~/repositories/mynewrepo.git,作为一个简单的回购)


是的,这就是我开始做的事情,它给了我这个错误。
supercheetah

@supercheetah它会在你声明一个新的回购时给你错误 gitolite.conf 文件并将其推送到gitolite服务器?你有没有 .gitolite.rc 在该服务器上的那个gitolite主目录中的文件?
VonC

这是正确的,是的,有一个 .gitolite.rc 文件。
supercheetah

0

我发现,如果Gitolite服务器上有用户,Git将登录该用户而不是通过Gitolite,我没有意识到这一点。我还有一个我试图在我的用户目录中推送的repo的副本,所以当然它不是裸露的。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.