Gitosis Error: Receiving 'Read Access Denied' on previously accessible repository

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

  • Warning and fatal error when using git on windows?
  • Access denied to file on windows 7 for Administrator account
  • 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!

  • Can I use Git for that?
  • How to remove a file from a git repository, without deleting it in cloned repositories
  • How can I change a specific font color in git?
  • Git on Windows: Where are my files?
  • Retrieve git information without retrieving file contents
  • Deploying a NodeJS App to Azure Websites fails on installing NPM packages from pagages.json from deploy.cmd?
  • 4 Solutions collect form web for “Gitosis Error: Receiving 'Read Access Denied' on previously accessible repository”

    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.

    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
    

    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.

    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.

    Git Baby is a git and github fan, let's start git clone.