Ubuntu 上 GitLab 协作功能使用指南
一 环境准备与访问
sudo apt-get updatesudo apt-get install -y curl openssh-server ca-certificates tzdata perlcurl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bashsudo apt-get install -y gitlab-ce/etc/gitlab/gitlab.rb,设置 external_url 'http://<你的服务器IP或域名>'sudo gitlab-ctl reconfigurehttp://<你的服务器IP或域名>,完成管理员初始化设置。二 成员与权限配置
三 日常协作流程
git clone git@<你的域名或IP>:username/project.gitgit clone https://<你的域名或IP>/username/project.gitgit checkout -b feature/logingit add . 与 git commit -m "描述"git push origin feature/loginfeature/login → main),填写标题与描述,指派评审人。git push origin --delete feature/login)。四 议题看板与自动化协作
.gitlab-ci.yml,定义流程(如 build → test → deploy),提交后自动触发流水线,保障代码质量与持续交付。
stages:
- build
- test
- deploy
build_job:
stage: build
script:
- echo "Building..."
test_job:
stage: test
script:
- echo "Running tests..."
deploy_job:
stage: deploy
script:
- echo "Deploying..."
git push 将触发上述流程,可在 GitLab CI/CD → Pipelines 查看任务状态与日志。