下面我按最常见的两种场景给你讲:
1)在 Ubuntu 上自建 GitLab(社区版)
2)Ubuntu 上配置 Git 客户端连接 GitLab
sudo apt update
sudo apt upgrade -y
建议内存 ≥ 4GB
sudo apt install -y curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安装(替换为你自己的域名):
sudo EXTERNAL_URL="http://gitlab.example.com" apt install gitlab-ce
sudo gitlab-ctl reconfigure
访问:
http://服务器IP
首次登录账号:root
密码在:
sudo cat /etc/gitlab/initial_root_password
编辑:
sudo vim /etc/gitlab/gitlab.rb
示例:
external_url 'http://gitlab.example.com'
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
改完执行:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
sudo gitlab-ctl stop
sudo gitlab-ctl restart
sudo gitlab-ctl status
sudo apt install git -y
git config --global user.name "yourname"
git config --global user.email "you@example.com"
ssh-keygen -t ed25519 -C "you@example.com"
查看公钥:
cat ~/.ssh/id_ed25519.pub
git clone git@gitlab.example.com:group/project.git
sudo ufw allow 80
sudo ufw allow 443
ssh -T git@gitlab.example.com
如果你是指:
告诉我,我可以直接给你对应方案。