在 Ubuntu 上“配 GitLab”通常有两种常见含义,我先帮你区分一下,然后分别说明:
适合:你想自己有一台 GitLab 服务器
sudo apt update
sudo apt install -y curl openssh-server ca-certificates tzdata perl
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
sudo EXTERNAL_URL="http://你的IP或域名" apt install gitlab-ee
例如:
sudo EXTERNAL_URL="http://192.168.1.100" apt install gitlab-ee
sudo gitlab-ctl reconfigure
浏览器打开:
http://你的IP
默认管理员:
rootsudo cat /etc/gitlab/initial_root_password
适合:你只是要用 GitLab(拉代码、推代码)
sudo apt update
sudo apt install git
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"
ssh-keygen -t ed25519 -C "你的邮箱"
查看公钥:
cat ~/.ssh/id_ed25519.pub
复制到 GitLab: User → Preferences → SSH Keys
git clone git@gitlab.com:用户名/项目.git
可关闭部分服务:
sudo gitlab-ctl stop prometheus
sudo gitlab-ctl stop grafana
docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 \
--name gitlab \
gitlab/gitlab-ee
如果你能告诉我:
我可以直接给你一步一步可复制的命令。