2. Deploy Git server-Windows environment to deploy Gitea

gitea_iconGitea is a self-hosted Git service, similar to GitHub, GitLab and other platforms, but it is very lightweight and easy to use, suitable for small and medium-sized teams. Gitea supports multiple languages, including Chinese, and has basic Git operation functions, such as warehouse management, version control, document management, issue tracking, Wiki, etc., and also supports plug-in extensions and Web hooks (Webhooks) functions. Gitea is written in Go language, so it runs fast, takes up less resources, has high stability, and does not require a lot of configuration and maintenance. It is an open source project, the code is hosted on GitHub and can be used for free.

1. Description

  1. This installation environment: Windows, Git, Gitea, SQLite .
  2. This time use the exe file to install.
  3. Gitea official website: https://about.gitea.com/
  4. Gitea official documentation: https://docs.gitea.com/zh-cn/
  5. Gitea hosts the source code on Github: https://github.com/go-gitea/gitea

2. Environment preparation

  1. Server: Gitea requires very little server resources. If it is used for team projects, it can be configured with 2-core CPU and 1GB memory or more. The current computer is much better than this configuration.
  2. Operating system: Support Linux, Windows, macOS, FreeBSD; I use Windows11.
  3. Git: Gitea relies on Git to perform various Git operations. The download path is https://git-scm.com/downloads
  4. Gitea: Download path https://dl.gitea.com/gitea/
    windows-4.0-amd64 is suitable for 64-bit Intel/AMD platform, 386 is suitable for 32-bit Intel/AMD platform. (Hint: The gogit-windows version has built-in gogit, which may alleviate the performance problems faced when the Go program calls the git subroutine on the old Windows platform), for example, download gitea-1.20.0-rc2-windows-4.0-amd64.exe
  5. Database: Databases supported by Gitea : PostgreSQL (>=10), MySQL (>=5.7), SQLite and MSSQL (>=2008R2 SP3), if there is no special requirement, you can use the built-in SQLite as the database to build a lightweight Gitea server , the data is directly stored in the file, and the backup and migration are more convenient.
    SQLite is used here, no need to download database software.

3. Installation and deployment

3.1 Install Git

  1. If Git is not installed, refer to https://blog.csdn.net/qq_30595441/article/details/130774970 to install it.
  2. If Git is installed, use the CMD window to check the Git version >= 2.0
C:\Users\sunshuai>git --version
git version 2.40.1.windows.1

insert image description here

3.2 Install Gitea

  1. The installation path of Gitea can be customized, copy the installation package to the installation directory, for example copy gitea-1.20.0-rc2-windows-4.0-amd64.exe to C:\app\gitea
  2. Double click to start the exe file
    gitea_firstrun
  3. For the first run, you need to open http://localhost:3000 to complete the initial installation of Gitea according to the guidelines. This step will create a configuration file and store it in C:\app\gitea\custom\conf\app.ini.
    1. Select SQLite3 as the database;
    2. The site name can be customized;
    3. The port can be customized, the default is 3000;
    4. In Windows, Gitea's RUN_USER (running as a user name) is not associated with the account system of the Windows system (this is different from Linux), so you can fill in any user name here, you can fill in git;
    5. The server domain name can fill in the computer name;
    6. Other configurations are performed as required.
      gitea_firstConfig
    7. Click Install Now. After the installation is complete, it will automatically enter the login interface. If no administrator account is set in the above figure, the first account registered now is also an administrator account.
      gites_firstLogin
    8. Click Register and fill in the account information to register an account.
      insert image description here
  4. Close the gitea.exe window to end the Gitea main program, or use Ctrl+C to end.

3.3 Register Gitea as a Windows service (optional)

If you think it is troublesome to start an exe every time, you can register it as a Windows service, and it will start automatically every time you boot.

  1. Run cmd as an administrator, and then execute the following command:
    Note that there is a space after the installation path, exe file name, start= and binPath=.
sc create gitea start= auto binPath= "\"C:\app\gitea\gitea-1.20.0-rc2-windows-4.0-amd64.exe\" web --config \"C:\app\gitea\custom\conf\app.ini\""
  1. Start gitea service
sc start gitea
  1. Delete gitea service (on demand)
    If there is a problem with the installation of the service, you can delete it and rebuild it. If you delete the service and make an error when rebuilding it, you can restart the computer.
sc delets gitea
  1. You can see the service you just created in Windows Services.

gitea_windowsService

3.4 Enable Gitea's built-in SSH server (optional)

Generally, Windows systems do not need to install OpenSSH service additionally. Gitea has a built-in lightweight Go SSH server, which can be opened manually by modifying the configuration file after installation.

Edit C:\app\gitea\custom\conf\app.ini, find the [server] entry and add START_SSH_SERVER = true to start the built-in SSH service.

Restart the Gitea service for it to take effect.

3.5 Edit Windows Firewall

If there is a problem with external computers accessing Gitea, you can check the firewall.

Guess you like

Origin blog.csdn.net/qq_30595441/article/details/131444956