git Gitosis 错误:在以前可访问的存储库上收到“拒绝读取访问”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3435776/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Gitosis Error: Receiving 'Read Access Denied' on previously accessible repository
提问by AwesomeYetIronicPseudonym
The Players
玩家们
I've been using git and gitosis for some months now, and am really loving both. Unfortunately, I have run into a problem accessing one of my projects with gitosis.
我已经使用 git 和 gitosis 几个月了,我真的很喜欢两者。不幸的是,我在使用 gitosis 访问我的一个项目时遇到了问题。
The Set-Up
设置
I set up my git and gitosis installs on a hosted server account running Debian. I also set up four computers (two Ubuntu, two Windows) with separate rsa keys and successfully set each up to access the gitosis install. Everything worked smoothly for some time. Recently, though, I have been unable to access my 'DesktopConfiguration' project in any way (push, pull, clone). I had originally created the DesktopConfiguration project on one of my Linux machines, pushed it to the gitosis server, and cloned it on one of my Windows machines. I have had no problems accessing it until recently (the last two weeks or so). Following is my gitosis.conf file and the error message that I am receiving (the error messages are the same whether I try to push, pull, or clone using my Windows or Linux boxes):
我在运行 Debian 的托管服务器帐户上设置了我的 git 和 gitosis 安装。我还使用单独的 rsa 密钥设置了四台计算机(两台 Ubuntu,两台 Windows),并成功设置了每台计算机以访问 gitosis 安装。一切都顺利进行了一段时间。但最近,我无法以任何方式(推、拉、克隆)访问我的“DesktopConfiguration”项目。我最初在我的一台 Linux 机器上创建了 DesktopConfiguration 项目,将它推送到 gitosis 服务器,然后将它克隆到我的一台 Windows 机器上。直到最近(过去两周左右),我才没有遇到访问它的问题。以下是我的 gitosis.conf 文件和我收到的错误消息(无论我尝试使用 Windows 或 Linux 机器推送、拉取还是克隆,错误消息都是相同的):
The Hook
钩子
gitosis.conf
gitosis.conf
[gitosis]
loglevel = DEBUG
[group gitosis-admin]
writable = gitosis-admin
members = windows-desktop linux-desktop linux-laptop work-laptop
[group main-projects]
writable = WallpaperChanger
writable = RegexTester
writable = MovieAggregator
writable = FileRenamer
writable = GlutenFreeShoppingAssistant
writable = Libraries
writable = DesktopConfiguration
writable = RssFeedReader
members = windows-desktop linux-desktop linux-laptop work-laptop
Error Message
错误信息
C:\Documents and Settings\myname\Desktop\Desktop Config Test>git clone git@myserver:DesktopConfiguration.git
Initialized empty Git repository in C:/Documents and Settings/myname/Desktop/Desktop Config Test/DesktopConfiguration/.git/
DEBUG:gitosis.serve.main:Got command "git-upload-pack 'DesktopConfiguration.git'"
DEBUG:gitosis.access.haveAccess:Access check for 'work-laptop' as 'writable' on 'DesktopConfiguration.git'...
DEBUG:gitosis.access.haveAccess:Stripping .git suffix from 'DesktopConfiguration.git', new value 'DesktopConfiguration'
DEBUG:gitosis.group.getMembership:found 'work-laptop' in 'main-projects'
DEBUG:gitosis.group.getMembership:found 'work-laptop' in 'gitosis-admin'
DEBUG:gitosis.access.haveAccess:Access check for 'work-laptop' as 'writeable' on 'DesktopConfiguration.git'...
DEBUG:gitosis.access.haveAccess:Stripping .git suffix from 'DesktopConfiguration.git', new value 'DesktopConfiguration'
DEBUG:gitosis.group.getMembership:found 'work-laptop' in 'main-projects'
DEBUG:gitosis.group.getMembership:found 'work-laptop' in 'gitosis-admin'
DEBUG:gitosis.access.haveAccess:Access check for 'work-laptop' as 'readonly' on 'DesktopConfiguration.git'...
DEBUG:gitosis.access.haveAccess:Stripping .git suffix from 'DesktopConfiguration.git', new value 'DesktopConfiguration'
DEBUG:gitosis.group.getMembership:found 'work-laptop' in 'main-projects'
DEBUG:gitosis.group.getMembership:found 'work-laptop' in 'gitosis-admin'
ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly
The Tale
故事
From my experience with gitosis and most of the questions-and-answers that I have found online, the error messages look exactly like the ones received when attempting to push to gitosis without having first added the project to a group that your machine has access to. Unfortunately, this does not appear to be true in my case. (Unless I am missing something!)
根据我对 gitosis 的经验以及我在网上找到的大多数问题和答案,错误消息看起来与尝试推送到 gitosis 时收到的消息完全一样,而没有先将项目添加到您的机器可以访问的组中. 不幸的是,在我的情况下,这似乎不是真的。(除非我遗漏了什么!)
The Wire
电线
I'm not exactly sure if this would provide some more information, but here are the debug messages from my post-update hook:
我不确定这是否会提供更多信息,但这里是来自我的更新后挂钩的调试消息:
INFO:gitosis.run_hook:Running hook post-update
DEBUG:gitosis.gitdaemon:Global default is 'deny'
DEBUG:gitosis.gitdaemon:Walking '.', seeing ['RegexTester.git', 'gitosis-admin.git', 'Libraries.git', 'GlutenFreeShoppingAssistant.git', 'MovieAggregator.git', 'DesktopConfiguration.git', 'WallpaperChanger.git', 'RssFeedReader.git', 'FileRenamer.git']
DEBUG:gitosis.gitdaemon:Deny 'RegexTester'
DEBUG:gitosis.gitdaemon:Deny 'gitosis-admin'
DEBUG:gitosis.gitdaemon:Deny 'Libraries'
DEBUG:gitosis.gitdaemon:Deny 'GlutenFreeShoppingAssistant'
DEBUG:gitosis.gitdaemon:Deny 'MovieAggregator'
DEBUG:gitosis.gitdaemon:Deny 'DesktopConfiguration'
DEBUG:gitosis.gitdaemon:Deny 'WallpaperChanger'
DEBUG:gitosis.gitdaemon:Deny 'RssFeedReader'
DEBUG:gitosis.gitdaemon:Deny 'FileRenamer'
INFO:gitosis.run_hook:Done.
The Shut-Out
关闭
I am still able to access (push, pull, clone) all of the other projects on the server (in both the gitosis-admin and main-projects groups) on all of my machines. Here are a few of the things that I have attempted so far:
我仍然可以在我的所有机器上访问(推送、拉取、克隆)服务器上的所有其他项目(在 gitosis-admin 和 main-projects 组中)。以下是我迄今为止尝试过的一些事情:
- I have checked the spelling of all of the folders, files, and configuration settings multiple times.
- I have removed and re-added the DesktopConfiguration project from the gitosis.conf file after ensuring that the post-update hook had the proper execution permissions.
- I added another project to gitosis after DesktopConfiguration, and it works properly.
- I have removed and re-added my remote references to the project in git on my local machines.
- I have removed the DesktopConfiguration.git project from my 'repositories' folder on the server and attempted to push to it again.
- I have even re-created all of my rsa keys (although authentication does not appear to have anything to do with the issues that I am seeing).
- 我已多次检查所有文件夹、文件和配置设置的拼写。
- 在确保更新后挂钩具有正确的执行权限后,我从 gitosis.conf 文件中删除并重新添加了 DesktopConfiguration 项目。
- 我在DesktopConfiguration 之后在gitosis 中添加了另一个项目,它工作正常。
- 我已经在本地机器上的 git 中删除并重新添加了对项目的远程引用。
- 我已经从服务器上的“存储库”文件夹中删除了 DesktopConfiguration.git 项目,并尝试再次推送到它。
- 我什至重新创建了我所有的 rsa 密钥(尽管身份验证似乎与我看到的问题没有任何关系)。
All of these attempts have failed to allow me to access the project. As far as I am aware, nothing changed on the server or my desktop machines around the time I lost access to this project.
所有这些尝试都未能让我访问该项目。据我所知,在我失去对这个项目的访问权时,服务器或我的台式机上没有任何变化。
The Sting
刺
I welcome any insights you may have with open arms!
我张开双臂欢迎您的任何见解!
采纳答案by signine
For 'read access denied' I'd be checking that the gitosis user on the server still had full access to the repositories. You say you're sure that nothing changed on the server, but you have ruled a lot of other things out. It can't hurt to double check.
对于“读取访问被拒绝”,我将检查服务器上的 gitosis 用户是否仍然可以完全访问存储库。你说你确定服务器上没有任何变化,但你排除了很多其他事情。仔细检查不会有什么坏处。
回答by Dean Serenevy
It seems signine got it correct in the comment reply. I was having the same problem and (after some wailing and gnashing of teeth) finally fixed the problem by placing all repositories on to a single "writable" line.
似乎 signine 在评论回复中得到了正确的答案。我遇到了同样的问题,并且(经过一些哀号和咬牙切齿之后)最终通过将所有存储库放在一个“可写”行上来解决这个问题。
Upon inspecting the source, one sees that gitosis uses ConfigParser which requires options appear on one line or you can break the line if you leave space at the beginning of the next line. Thus:
在检查源代码时,可以看到 gitosis 使用 ConfigParser,它要求选项出现在一行中,或者如果在下一行的开头留有空格,则可以中断该行。因此:
writable = WallpaperChanger RegexTester MovieAggregator FileRenamer
or
或者
writable = WallpaperChanger RegexTester
MovieAggregator FileRenamer
回答by Jim
I had a similar issue and the problem was quite simple :
我有一个类似的问题,问题很简单:
I mistakenly created 2 different key fileswith the same public key, the result being that the server recognized me as this new user (with no rights to a certain repo) instead of myself (with read/write access to this repo).
我错误地使用相同的公钥创建了2 个不同的密钥文件,结果是服务器将我识别为这个新用户(对某个 repo 没有权限)而不是我自己(对这个 repo 具有读/写访问权限)。
This had me scratching my head so I figured I'd share.
这让我摸不着头脑,所以我想我会分享。
回答by Juampy
I have seen that having a line such as
我已经看到有一条线,例如
writable =
can break access to all repositories. This happened because our gitosis.conf is auto generated and it got to the scenario where a group had no repositories.
可以中断对所有存储库的访问。发生这种情况是因为我们的 gitosis.conf 是自动生成的,并且它进入了一个组没有存储库的场景。