Soon or later you start to think “What if my GitHub account will be hacked and all of my private git repositories would be stolen. And the first idea, which would probably come to your head is to make your own git server. I found a really good one – Gitea. In this example we will set it up on Docker

If you think that those open source git servers have a weird or uncomfortable design, I will break this fact and say that it totally looks like GitHub’s design.

In this article, I will use my Ubuntu Server for that.

Step 1: Installing Docker

First of all, we would need to update our source list sudo apt-get update and then install docker-compose sudo apt-get install docker-compose.

Step 2: Configuring container

Then we would need to create a directory in root folder. You can name it however you want to, in my case I will use name “gitea”. Now let’s create a configuration file docker-compose.yml and add following text in (check carefully port numbers, 22-ssh and 3000 – HTTP)

version: "2"

external: false

image: gitea/gitea:latest
restart: always
- gitea
- ./gitea:/data
- "3000:3000"
- "222:22"

Step 3: Configuring git server

Then type sudo docker-compose up, and it will set it up and run our git server. Now you can see all debug information so, go to localhost:3000 (or if you have git server on external computer – server, use its IP and then after the IP put :3000) and set it up. When you finish, close text file and type sudo docker-compose down.

And now we will start it again, but in the background sudo docker-compose up -d.


When you finish, try if it works.

As you can see, now you have your own git server!

But probably you don’t like that your link is like, if you want to use it without “:3000”, you can read my article “How to set up a proxy on Apache and NGINX”. Where I will explain how to work with domain only, so like, and it will access automatically without changing the link.

If you have some questions or problems please write a comment under the post.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.
I agree to have my personal information transfered to MailChimp ( more information )