Moving DevOps platform from Gogs to Gitea
By Vilem Otte
DevOps Platforms
Gogs
For past years I've been using Gogs as a DevOps platform for my private projects. I have originally chose this platform and used it for years mainly due to low hardware requirements, very fast loading times and nice and easy setup. These advantages still apply and as described - it is A painless self-hosted Git service.
But comparing to other platforms I've regularly used, which include GitLab and Azure DevOps ... it just started to be kind of lacking.
I was looking for my options, and I wanted to keep it lightweight, as GitLab is capable of everything I'd require, yet its requirements are kind of high.
Gitea
Originally this was created as a fork of Gogs. It has progressed much since and it is in some ways definitely a major improvement. It still kept the idea of self-hosting, and not just cloud service (which is something I prefer).
Compared to Gogs, it is not just a self-hosted Git service ... but a full platform for doing DevOps.
So I went ahead and decided to do a migration...
Migration
Installation
I was a bit concerned about setting up Gitea for the first time, I started by creating a blank installation. It is, much like Gogs, shipped as single static Go binary, so installation on linux is trivial. Get it, install it.
First a setup of users and directories:
sudo adduser --````system```` --shell /bin/bash --group --disabled-password --home /home/gitea gitea
sudo mkdir -p /var/lib/gitea/{custom,data,log} /etc/gitea
sudo chown -R gitea:gitea /var/lib/gitea
sudo chown root:gitea /etc/gitea && sudo chmod 770 /etc/gitea
Something as simple as (specific version, yeah):
wget -O gitea https://dl.gitea.com/gitea/28.4.0/gitea-28.4.0-linux-amd64
sudo install -m 755 gitea /usr/local/bin/gitea
Minimal config:
sudo tee /etc/gitea/app.ini >/dev/null <<'EOF'
RUN_USER = gitea
WORK_PATH = /var/lib/gitea
[server]
HTTP_ADDR = 127.0.0.1
HTTP_PORT = 3001
EOF
sudo chown gitea:gitea /etc/gitea/app.ini
Next setup systemd service:
sudo tee /etc/````system````d/````system````/gitea.service >/dev/null <<'EOF'
[Unit]
Description=Gitea
After=network.target
[Service]
User=gitea
Group=gitea
WorkingDirectory=/var/lib/gitea
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=gitea HOME=/home/gitea GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target
EOF
sudo ````system````ctl daemon-reload && sudo ````system````ctl enable --now gitea
And next - from your client bridge some port for installation:
ssh -L 3001:127.0.0.1:3001 user@server
And now from http://localhost:3001 you can freely install.
Once done, lock down config with:
sudo chmod 750 /etc/gitea && sudo chmod 640 /etc/gitea/app.ini
And you're done!
From Gogs to Gitea
Migrations are kind of straight forward. First start by updating Gitea ini - /etc/gitea/app.ini:
[migrations]
ALLOW_LOCALNETWORKS = true
Next, create tokens on both - Gogs and Gitea (needs read/write access on Gitea).
And - all you now need is add projects with + and New Migration. Select Gogs, fill in original repo, Gogs access token and items to migrate. Works like a charm. So ... why Gitea token? In case you want to use API to migrate all repos automatically. I have done so and it worked flawlessly.
It's as simple as just reading all repos from Gogs, and calling repos/migrate endpoint on Gitea with respective params.
Conclusion
One of the smoothest migrations I have ever done. Everything just worked. Great thanks to both teams - one working on Gogs and one on Gitea.
If you're interested in any of those, please visit their sites.
Gogs - https://gogs.io/getting-started/introduction
Gitea - https://about.gitea.com/
Farewell Gogs! It has been a ride!
Disclaimer: Gogs and Gitea logos and names are the property of their respective owners. The Gogs logo is licensed under CC BY-SA 4.0, and the Gitea logo is licensed under the MIT License. This article is an independent technical guide and is not affiliated with or endorsed by either project.