Gitea

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋

Gitea一套輕量級的Git託管軟體。

安裝

這邊的安裝是假設在Ubuntu 22.04下,請先安裝MySQL,然後建立對應的資料庫相關權限:

CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
CREATE USER 'gitea'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'%';

接著先建立使用者帳號:

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

再來建立對應的目錄結構(這邊的/etc/gitea設為770是暫時性的,後續等Gitea把設定檔寫進去後就會修正):

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

接著下載軟體檔案:

GITEA_VER=1.21.7; sudo mkdir -p /usr/local/bin; cd /usr/local/bin; sudo wget -c https://github.com/go-gitea/gitea/releases/download/v${GITEA_VER}/gitea-${GITEA_VER}-linux-amd64; sudo chmod 755 gitea-${GITEA_VER}-linux-amd64; sudo ln -sf gitea-${GITEA_VER}-linux-amd64 gitea

然後是systemd的設定檔:

cd /etc/systemd/system; sudo wget -c https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/systemd/gitea.service; sudo systemctl daemon-reload; sudo systemctl enable --now gitea

預設會跑在機器的127.0.0.1:3000上。

act_runner

act_runner是Gitea的CI工具,目前還在alpha版:

GITEA_ACT_RUNNER_VER=0.2.6; sudo mkdir -p /usr/local/bin; cd /usr/local/bin; sudo wget -c https://gitea.com/gitea/act_runner/releases/download/v${GITEA_ACT_RUNNER_VER}/act_runner-${GITEA_ACT_RUNNER_VER}-linux-amd64; sudo chmod 755 act_runner-${GITEA_ACT_RUNNER_VER}-linux-amd64; sudo ln -sf act_runner-${GITEA_ACT_RUNNER_VER}-linux-amd64 act_runner

外部連結