在Linux環境下使用GitLab進行版本控制,可以按照以下步驟進行操作:
使用官方安裝腳本:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
使用Docker:
docker pull gitlab/gitlab-ce:latest
docker run --detach \
--hostname my-gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /var/log/gitlab:/var/log/gitlab \
--volume /var/opt/gitlab:/var/opt/gitlab \
gitlab/gitlab-ce:latest
http://your-server-ip
來配置GitLab,按照網頁上的指示完成初始設置,包括設置管理員密碼、配置域名等。git clone http://your-server-ip/username/project-name.git
cd project-name
git status
git add filename
git commit -m "Commit message"
git push origin master
git pull origin master
git branch new-feature
git checkout new-feature
git checkout master
git merge new-feature
git push origin master
.gitlab-ci.yml
文件來定義CI/CD管道。通過以上步驟,你可以在Linux環境下使用GitLab進行有效的版本控制。