Boela kwa blog
Tlhakole 2, 2026Dikaelo

Tsela ya go Seta Git Server ya Boswa mo VPS

Tlhahiso e e feletseng ya go seta Git server ya gago ya boswa mo VPS. Ithute tsela ya go ipusa di-repository tsa Git ka taolo e e feletseng le boswa ka go dirisa GitLab, Gitea, kgotsa di-repository tsa bare.

Tsela ya go Seta Git Server ya Boswa mo VPS

Go ipusa Git server ya gago go go fa taolo e e feletseng mo di-repository tsa gago tsa khoutu, go tiisa boswa le go fologa go ikamela ditirelo tsa ba ba tlhano. Le fa o tlhoka repository e e bonolo ya bare kgotsa platform e e nang le dintlha tsotlhe ya Git hosting, tlhahiso eno e akaretsa dikgetho tse dintsi bakeng sa go seta Git server ya boswa mo VPS ya gago.

Ke Eng Se Lebelelang go Ipusa Git Server ya Gago?

  • Boswa jwa botlalo: Khoutu ya gago e nna mo servering ya gago
  • Ga go na go tswala ke moabi: Taolo e e feletseng mo di-repository tsa gago
  • Go fetola: Seta ka tsela e o e batlang
  • Tlhwatlhwa e e nonofileng: Server e le nngwe bakeng sa di-repository tse di se nang tekanyo
  • Go ikamanya: Tshwanelela dinyeletso tsa go nna ga data
  • Go ithuta: Kwelela dintlha tsa ka teng tsa Git server

Kgetho 1: GitLab (E e Nang le Dintlha Tsotlhe)

GitLab e neela platform e e feletseng ya DevOps:

bash
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
apt install gitlab-ce

gitlab-ctl reconfigure
# Fihlela GitLab kwa http://your-server-ip
# Leina la motirisi la motheo: root
# Seta password mo go tseneng ga ntlha

Kgetho 2: Gitea (E e Bonolo)

Gitea ke tirelo ya Git e e bonolo, e e ipusang:

bash
wget -O gitea https://dl.gitea.io/gitea/1.21.0/gitea-1.21.0-linux-amd64
chmod +x gitea
mv gitea /usr/local/bin/

# Dira tirelo ya systemd
nano /etc/systemd/system/gitea.service
# Seta mme o simolotse Gitea
systemctl enable gitea
systemctl start gitea

Kgetho 3: Git Repository ya Bare (E e Bonolo)

Bakeng sa Git hosting e e motheo ntle le interface ya web:

bash
mkdir -p /srv/git/myproject.git
cd /srv/git/myproject.git
git --bare init

# Seta di-permission tse di siameng
chown -R git:git /srv/git
chmod -R 755 /srv/git

# Clone go tswa mo client:
git clone git@your-server:/srv/git/myproject.git

Go Seta Pono ya SSH

Seta SSH bakeng sa pono e e sireletsegileng ya Git:

bash
adduser git
su - git
mkdir .ssh
chmod 700 .ssh
nano .ssh/authorized_keys
# Oketse di-key tsa setšhaba tsa ba-developer
chmod 600 .ssh/authorized_keys

# Leka kgolagano:
ssh git@your-server

Ditiro Tsa Botlhale Tsa Tshireletso

  • Dirisa di-key tsa SSH mo boemong jwa di-password
  • Nolofatsa go netefatsa ka mekgwa e mebedi (GitLab/Gitea)
  • Di-backup tsa nako le nako tsa di-repository
  • Boloka software ya Git server e ntsha sephiri
  • Seta firewall go thibela pono
  • Dirisa SSL/TLS bakeng sa di-interface tsa web
  • Dirisa go laola pono le di-permission
  • Lokela di-log bakeng sa tiro e e tshosang

Molebo wa Backup

Di-backup tsa nako le nako di botlhokwa:

bash
#!/bin/bash
# Script ya backup ya Git repository
BACKUP_DIR="/backup/git"
REPO_DIR="/srv/git"
DATE=$(date +%Y%m%d)

tar -czf $BACKUP_DIR/git-backup-$DATE.tar.gz $REPO_DIR
# Boloka malatsi a 30 a bofelo
find $BACKUP_DIR -name "*.tar.gz" -mtime +30 -delete