linuxgitgitosis

Where can I find for the location of the repos managed by Gitosis in Linux


We are using Gitosis in our Linux OS server to manage our projects. One time, I mistakenly pushed the config file which contains errors and then I wasn't able to push changes or clone copies of other projects from the server anymore, including gitosis-admin itself. Now, I need to login to the server using the root user and edit the config file there.

So, when I logged on to the server I saw these files:

enter image description here

Then I cd into gitosis-admin:

enter image description here

Then I cd again into gitosis-admin:

enter image description here

Then I vim the config file. This is what I see:

enter image description here

The content is obviously not what I am expecting, because I should have other repos listed in this config file.

I also double checked with git reflog to see the commit history:

enter image description here

Then I thought there might be another gitosis-admin located somewhere else so I search using the command: find / -type d -name 'gitosis-admin'

This is what I got:

enter image description here

The two directories are the ones that I checked. And they do not match the one I have in my local computer.

I tried searching for one of our projects but still I got no result at all.

Then I thought that the root might not have access to the repo files so I switched to the git user by executing the following command:

sudo git

But still, I can't find the directory of the repos.

So now, I need to know where are the repos located so that I might find the "real" gitosis-admin there.

You might be wondering am I checking on the wrong server here. So to prove that I am not mistaken, this is a screenshot of the host address that I am connected to:

enter image description here

This is the remote address of the gitosis-admin git repo shown in source tree:

enter image description here


Solution

  • A typical directory would be the repositories sub-directory of the git user's $HOME directory, that is

    ~git/repositories
    

    It is possible to change this location using the repositories key of the gitosis section in the configuration file, which typically is a file named .gitosis.conf in the git user's home directory.

    To answer the implied question (namely which file to fix to restore gitosis access), that would be ~git/.gitosis.conf as well.

    (This is all documented in the gitosis repository's readme file.)