Original link: https://editor.leonh.space/2022/gitea/
If you want to set up your own Git server, the mainstream choices are probably Gitea and GitLab. Although I have always been a lover of GitLab, if I set up my own Git server, I have to think twice. First of all, GitLab itself is a big toy. It’s a bit more complicated to erect or maintain, especially maintenance. It should be some distance away from being ignored after shooting. The advantage of Gitea is that it is compact and functional. Deducting the configuration file, there is only one solid The executable file, the database supports SQLite, and it is also exquisite, compact and full-featured. This combination is exactly what I need to ignore after shooting.
Gitea’s webpage also clearly presents its own characteristics:
The only thing that Gitea lacks is that there is no built-in CI, but it doesn’t matter. There are also a lot of CIs on the market that can be connected to it. The CI most people use with Gitea should be Drone CI. In short, although Gitea does not have CI, But it won’t be a problem.
After getting to know Gitea, readers should also be able to decide whether Gitea is suitable for them, and then read the installation and configuration section below.
Gitea installation and configuration
Install
The easiest installation is not Docker, but Snap, with just one line:
$ sudo snap install gitea
After the installation is complete, it will run by itself and enter http://127.0.0.1:3000/ for initialization. The initialization page is also very simple, so I won’t mention it here.
After running the initialization page, you should be able to log in. After logging in, the long image is similar to the previous GitHub. Friends who have used GitHub / GitLab should be able to get started without pain.
configure
The configuration file of Gitea is in /var/snap/gitea/common/app.ini, there are many items in it, generally do not need to be moved.
But the SSH part may need to be changed.
Because Linux has already opened SSH service, port 22 has been occupied. Based on the principle of one port for one thing, the Gitea SSH port is changed to 23.
Open that app.ini and make sure the [server] section has the following lines:
[server] DISABLE_SSH = false START_SSH_SERVER = true SSH_PORT = 23
These lines should make sense.
Restart the service after the change, Gitea’s service name is snap.gitea.web.service:
$ sudo systemctl restart snap.gitea.web.service
Take a look at the status:
$ sudo systemctl status snap.gitea.web.service
If the status is green, there is no problem, and then try pull / push with Git SSH, no problem, no problem.
After running here for about ten minutes, I came to talk about why I built my own Git server after finishing work.
Why build your own Git Server?
The front is all about the what & how of self-built Gitea. Let’s talk about why. GitLab / GitHub is so fragrant, and there are free CI quotas. Why do you need to build your own Git server (and Drone CI)?
It’s not because the free CI is not enough. If you want an unlimited CI runner, you can only build CI and then connect it to gitlab.com.
The heartwarming reason behind the self-built Git server is the organization’s information security policy. They think that if the Git server and xxx server are closed on the intranet, it will be very safe .
Whether this kind of information lock-in policy is useful or not, you will know by looking at the new crown epidemic. In short, anyway, that’s it.
This article is reprinted from: https://editor.leonh.space/2022/gitea/
This site is for inclusion only, and the copyright belongs to the original author.