搭建gitlab

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安装gitlab源仓库

sudo apt install gitlab-ce
安装gitlab

sudo apt install -y postfix
安装邮件服务

sudo vi /etc/gitlab/gitlab.rb
/external_url

找到没被注释的external_url行,赋值external_url 'http://ip:8088',通过ip addr找出wsl ip,端口可以改成其他值

sudo gitlab-ctl reconfigure
如果遇到在ruby_block处卡住,打开新的wsl窗口执行命令sudo /opt/gitlab/embedded/bin/runsvdir-start,参考链接:reconfigure 卡住 ruby_block[wait for redis service socket] action run
sudo gitlab-ctl restart

本次安装gitlab失败处来了,restart报错fail: alertmanager: runsv not running等,启动服务sudo service gitlab-runsvdir start发现不存在该名称的服务,走不下去了。

参考文献:本地搭建gitlab服务器(Ubuntu)

在Ubuntu上搭建Gitlab服务器(2020年)

GetLab启动失败:fail: alertmanager: runsv not running

修复 “System has not been booted with systemd as init system “的错误。

本地ssh+git

参考自在服务器上搭建git服务

上述gitlab安装过程已为wsl创建了git用户,且git用户的家目录路径是/var/opt/gitlab

1
2
3
4
5
6
7
8
sudo mkdir /home/git
cd /home/git
cd ..
sudo mkdir gitrepo
sudo chown git:git gitrepo
cd gitrepo
git init --bare test.git
sudo chown -R git:git test.git

将git用户加入sudo组中sudo usermod -aG sudo git

参考文献:在 Ubuntu 中如何将用户添加到 Sudoers

创建于2023.1.17/18.23,修改于2023.1.17/18.23