You should use a Raspberry Pi with at least 4 or better 8 GB RAM. In case you use a MicroSD then it is also good practice to not work with SWAP on the Raspberry Pi:
sudo dphys-swapfile uninstall
After that let’s install some stuff:
sudo apt-get install curl openssh-server ca-certificates apt-transport-https perl
curl https://packages.gitlab.com/gpg.key | sudo tee /etc/apt/trusted.gpg.d/gitlab.asc
Install Postfix to be able to send emails:
sudo apt-get install -y postfix
Usually we would now run:
pi@rpi0100:~ $ sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash
But at this date there is support for Raspbian Bullseye, however Raspbian Buster does the trick here too:
pi@rpi0100:~ $ sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo os=raspbian dist=buster bash
Now it is time to finally install Gitlab. Make sure your Raspberri Pi is reachable from the internet (ports: 443 for https, 80 for letsencrypt, 22 for git clone via ssh) on the external url that you will set within the following command:
pi@rpi0100:~ $ sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ce
After the last step you will find a temporary password for the user root in the file /etc/gitlab/initial_root_password which will be valid for 24 hours.
pi@rpi0100:~ $ sudo vi /etc/gitlab/initial_root_password
Use the user root and the temporary password to set a new password for root and maybe create a first user with a hello-git project and add a SSH Public Key. On for example your local Windows 10/11 machine that belongs to the SSH Public Key then test that the ssh connection works:
C:\Users\user\Git>ssh -T git@gitlab.example.com
And clone your first project:
C:\Users\user\Git>git clone git@gitlab.example.com:first.user/hello-git.git