How to install Gitosis on Ubuntu 22.04

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install Gitosis on Ubuntu 22.04.

According to the GitHub profile

gitosis is a software for hosting git repositories. You can manage git repositories, provide access to them over SSH, with tight access control and not needing shell accounts.

This solves a question for git workgroups, which is the sharing of that repository with other users.

Let’s go for it.

Install Gitosis on Ubuntu 22.04

One of the best ways to get it is through the source code.

First, open your terminal or connect via SSH to the server and update it

sudo apt update
sudo apt upgrade

Then, you can install the necessary dependencies for the Gitosis installation.

sudo apt install openssh-server git-core python-setuptools

Thereafter, you can install it. First, clone the tool’s repository

git clone

Now install it with the following command

cd gitosis/
sudo python3 install
Install Gitosis on Ubuntu
Install Gitosis on Ubuntu

Furthermore, you can use the --prefix option to set a specific installation path.

That’s how simple the installation is done. Now it is time to configure it.

Configure Gitosis on Linux

Once the installation is complete, it is time to do the first configuration.

To achieve this, create a new user who will be the owner of the folder where the repository will be.

sudo adduser \
    --shell /bin/sh \
    --gecos 'git version control' \
    --home /home/angelo/sample/ \

Sample output:

Adding system user `git' (UID 114) ...
Adding new group `git' (GID 119) ...
Adding new user `git' (UID 114) with group `git' ...
Creating home directory `/home/angelo/sample/' ...

In this case, a user has been created with the name git but in reality it can be called anything. The value of the --home parameter will be the path to the repository.

Next, copy your ssh public key to the server

scp ~/.ssh/ root@YOUR_SERVER:/tmp

If you do not have an SSH key, you will need to create one. The process is not complex, so you can take a look at the ssh-keygen command.

Apply the SSH key configuration with the command

sudo -H -u git gitosis-init < []

For example:

sudo -H -u git gitosis-init < /tmp/

Then, assign correct permissions

sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

And clone the repository to start enjoying Gitosis and its power

git clone git@SERVER:gitosis-admin.git

And you get a repository with SSH keys as keys/ and a gitosis.conf where you can configure who has access to what.

Edit the settings as you wish, commit and push. That’s mostly it! Once you push, gitosis will immediately make your changes take effect on the server.

How to add new developers?

Well, the first thing you have to do is to upload the SSH key to the key directory. Remember that in this post, I have used /tmp/ but it could be another one.

In short, you must do the following:

  • add a keys/ file
  • authorize them to read/write repositories as needed

To authorize, you must edit the gitosis.conf file and from there give appropriate permissions. For example, if the new user is samp then.

[group new_repo]
writable = new_repo
members = dev_one dev_two samp

Members refers to an SSH key. So is dev_one and so on.

To apply the changes, push to the git repository, and it is done.


In this post, you learned how to install Gitosis to share repositories with other developers.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook