Gitosis 错误:接收“读取访问被拒绝”在以前可访问的存储库上

发布于 2024-09-13 13:34:13 字数 4272 浏览 1 评论 0原文

玩家

我已经使用 git 和 gitosis 几个月了,我真的很喜欢这两者。不幸的是,我在使用 gitosis 访问我的一个项目时遇到了问题。

设置

我设置了 git,并将 gitosis 安装在运行 Debian 的托管服务器帐户上。我还使用单独的 rsa 密钥设置了四台计算机(两台 Ubuntu,两台 Windows),并成功设置每台计算机以访问 gitosis 安装。一段时间以来一切都很顺利。不过,最近我无法以任何方式(推、拉、克隆)访问我的“DesktopConfiguration”项目。我最初在我的一台 Linux 计算机上创建了 DesktopConfiguration 项目,将其推送到 gitosis 服务器,然后将其克隆到我的一台 Windows 计算机上。直到最近(过去两周左右)我访问它都没有问题。以下是我的 gitosis.conf 文件和我收到的错误消息(无论我尝试使用 Windows 还是 Linux 机器进行推送、拉取或克隆,错误消息都是相同的):

Hook

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  

错误消息

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  

故事

来自的 根据我使用 gitosis 的经验以及我在网上找到的大多数问答,错误消息看起来与尝试推送到 gitosis 时收到的消息完全相同,而没有先将项目添加到您的计算机可以访问的组中。不幸的是,在我的例子中,情况似乎并非如此。 (除非我遗漏了一些东西!)

The Wire

我不确定这是否会提供更多信息,但这里是来自我的更新后挂钩的调试消息:

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.  

Shut-Out

我仍然能够访问的 (推,在我的所有机器上拉取、克隆)服务器上的所有其他项目(在 gitosis-admin 和 main-projects 组中)。以下是我迄今为止尝试过的一些事情:

  • 我多次检查了所有文件夹、文件和配置设置的拼写。
  • 在确保更新后挂钩具有正确的执行权限后,我已从 gitosis.conf 文件中删除并重新添加了 DesktopConfiguration 项目。
  • 我在DesktopConfiguration之后添加了另一个项目到gitosis,并且它工作正常。
  • 我已在本地计算机上的 git 中删除并重新添加了对项目的远程引用。
  • 我已从服务器上的“存储库”文件夹中删除了 DesktopConfiguration.git 项目,并尝试再次推送到它。
  • 我什至重新创建了所有 rsa 密钥(尽管身份验证似乎与我所看到的问题没有任何关系)。

所有这些尝试都未能让我访问该项目。据我所知,在我失去对该项目的访问权限期间,服务器或我的台式机上没有任何变化。

我张开双臂

欢迎您提出任何见解!

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.

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):

The Hook

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!)

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:

  • 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).

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

寄人书 2024-09-20 13:34:13

对于“读取访问被拒绝”,我将检查服务器上的 gitosis 用户是否仍然具有对存储库的完全访问权限。你说你确定服务器上没有任何变化,但你已经排除了很多其他事情。仔细检查一下也没什么坏处。

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.

痴情 2024-09-20 13:34:13

看来signine在评论回复中说的是正确的。我遇到了同样的问题,(在一番哀嚎和咬牙切齿之后)最终通过将所有存储库放置在一条“可写”行上解决了问题。

检查源代码后,我们会发现 gitosis 使用 ConfigParser,它要求选项出现在一行上,或者如果在下一行的开头留有空格,则可以断行。因此:

writable = WallpaperChanger RegexTester MovieAggregator FileRenamer

writable = WallpaperChanger RegexTester
           MovieAggregator FileRenamer

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.

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:

writable = WallpaperChanger RegexTester MovieAggregator FileRenamer

or

writable = WallpaperChanger RegexTester
           MovieAggregator FileRenamer
妄想挽回 2024-09-20 13:34:13

我遇到了类似的问题,问题非常简单:

我错误地使用相同的公钥创建了2个不同的密钥文件,结果是服务器将我识别为新的用户(对某个存储库没有权限)而不是我自己(具有对此存储库的读/写访问权限)。

这让我摸不着头脑,所以我想我应该分享一下。

I had a similar issue and the problem was quite simple :

I mistakenly created 2 different key files with 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).

This had me scratching my head so I figured I'd share.

°如果伤别离去 2024-09-20 13:34:13

我已经看到,使用诸如此类的行

writable =

可以中断对所有存储库的访问。发生这种情况是因为我们的 gitosis.conf 是自动生成的,并且它遇到了一个组没有存储库的情况。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文