Gitea is the fastest and most painless self-hosted Open source Git Service. Gitea is written in Go and distributed as a binary package that runs across all platforms and architectures that Go supports – Linux, macOS, and Windows. In this guide, we’ll install and configure Gitea Git Service on Debian 10 (Buster) Linux.

Gitea Key Features

  • Free and Open source
  • Has low resource usage – both RAM and CPU
  • Multiple database support
  • Markdown and Orgmode support
  • Integrated Git-powered wiki
  • Repository Tokens with write rights
  • External git mirroring
  • Git LFS 2.0
  • Granular user roles (Code, Issues, Wiki etc)
  • GPG Signed Commits
  • Web Code editor
  • Commit graph
  • Issue search & Issue tracker
  • Restrict push and merge access to certain users
  • Webhook support
  • Multiple LDAP / AD server support
  • LDAP user synchronization
  • Two factor authentication (2FA)
  • OpenId Connect support
  • OAuth 2.0 integration (external authorization)
  • Mattermost/Slack integration
  • Microsoft Teams integration
  • External CI/CD status display
  • and many others

In this tutorial, we’ll do installation of Gitea on Debian 10 (Buster) Linux and configure Nginx proxy to forward requests to Gitea internal service on a port. With Nginx, you can optionally terminal SSL certificates when doing a secure setup on Gitea on Debian 10 Server.

Step 1: Update System and Install git

You need to have git installed in your Debian machine. Let’s update our OS and ensure git is installed.

sudo apt -y update
sudo apt -y install git vim bash-completion

View the version of Git installed.

$ git --version
git version 2.20.1

Step 2: Add git user account for Gitea

Gitea should have a dedicated local user account for management operations. Add the user and group to your Debian system by running the following commands.

sudo adduser \
   --system \
   --shell /bin/bash \
   --gecos 'Git Version Control' \
   --group \
   --disabled-password \
   --home /home/git \

The user creation will assign a unique ID for the user and create its home directory.

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

Step 3: Install MariaDB database server

Data will be stored on MariaDB database server.

sudo apt -y install mariadb-server

Secure your database installation by setting root password and removing test database and users.

$ sudo mysql_secure_installation 


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Create a database for Gitea.

$ sudo mysql -u root -p

GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY "[email protected]";

Step 4: Install Gitea on Debian 10 (Buster)

The gitea binary packages are available on the Downloads page. Check the latest release before downloading it.

curl -s |grep browser_download_url  |  cut -d '"' -f 4  | grep '\linux-amd64$' | wget -i -

Move the downloaded binary file to the /use/local/bin

chmod +x gitea-*-linux-amd64
sudo mv gitea-*-linux-amd64 /usr/local/bin/gitea

Confirm successful installation by checking the version of Gitea installed.

$ gitea --version
Gitea version 1.14.4 built with GNU Make 4.1, go1.16.5 : bindata, sqlite, sqlite_unlock_notify

Step 5: Configure Systemd

Create directories required for Gitea setup.

sudo mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}
sudo chown git:git /var/lib/gitea/{data,indexers,log}
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea

The web installer will need write permission configuration file under /etc/gitea

Create a systemd service file for Gitea.

sudo vim /etc/systemd/system/gitea.service

Configure the file and set UserGroup and WorkDir.

Description=Gitea (Git with a cup of tea)

ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea


Reload systemd and restart Gitea service.

sudo systemctl daemon-reload
sudo systemctl enable --now gitea

Check service status.

$ systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
   Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-10-20 07:37:06 UTC; 27s ago
 Main PID: 2637 (gitea)
    Tasks: 9 (limit: 4719)
   Memory: 93.8M
   CGroup: /system.slice/gitea.service
           └─2637 /usr/local/bin/gitea web -c /etc/gitea/app.ini

Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 routers/init.go:74:GlobalInit() [T] Custom path: /var/lib/gitea/custom
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 routers/init.go:75:GlobalInit() [T] Log path: /var/lib/gitea/log
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 ...dules/setting/log.go:226:newLogService() [I] Gitea v1.9.4 built with GNU Make 4.1, go1.12
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 ...dules/setting/log.go:269:newLogService() [I] Gitea Log Mode: Console(Console:info)
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 ...les/setting/cache.go:42:newCacheService() [I] Cache Service Enabled
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 ...s/setting/session.go:45:newSessionService() [I] Session Service Enabled
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 routers/init.go:106:GlobalInit() [I] SQLite3 Supported
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 routers/init.go:37:checkRunMode() [I] Run Mode: Development
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 cmd/web.go:151:runWeb() [I] Listen:
Oct 20 07:37:06 deb10 gitea[2637]: 2019/10/20 07:37:06 ...ce/gracehttp/http.go:142:Serve() [I] Serving [::]:3000 with pid 2637

Step 6: Configure Nginx proxy

Install nginx on Debian 10.

sudo apt -y install nginx

If ufw is enabled, allow http and https ports.

for i in http https; do
 sudo ufw allow $i

Create Nginx configuration file for Gitea

sudo vim /etc/nginx/conf.d/gitea.conf

Paste below data into the file created.

server {
    listen 80;

    location / {
        proxy_pass http://localhost:3000;

Set correct domain name and restart nginx service.

sudo systemctl restart nginx

Step 7: Finish Gitea Installation from Web interface

After configuring Nginx proxy, access Gitea web interface on http://servername/install

install gitea debian 10 01

Set database authentication

On the first page, set the database connection

gitea configure mysql ubuntu 18.04 min

The username and password provided should match the ones provided in the Database configuration section. If the database server is on a different host, provide the IP address under the Host section.

Set Application General Settings

Set SSH Server domain – should be same domain used in Nginx configuration.

install gitea debian 10 04

Provide application URL, and HTTP Listen port. Since we’re using Nginx proxy, there is no need to change default values.

install gitea debian 10 03

Disable User self-registration

You can disable User self-registration under “Server and Other Services Settings”. This means the admin user will manually create user accounts.

install gogs git service ubuntu 18.04 disable self registration min

You can optionally create an admin user account. By default, root user will gain admin access automatically.

install gitea debian 10 02

When done with the configurations, click the “Install Gitea” button to finish the installation. On a successful installation, you should be logged into Gitea administration console.

install gitea debian 10 06

You have successfully install Gitea on Debian 10 (Buster) server. Refer to Gitea Documentation for advanced configurations and usage guides.

Git Learning Video Courses

More git related guides.

How To Install and Configure GitLab CE on Debian 10 (Buster)

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here