在Linux系统中使用GitLab进行版本控制,可以按照以下步骤进行操作:
sudo apt update && sudo apt upgrade
sudo yum update
sudo apt install -y curl openssh-server ca-certificates tzdata perl
sudo yum install -y curl policycoreutils-python openssh-server perl
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo apt install -y gitlab-ce
sudo yum install -y gitlab-ce
/etc/gitlab/gitlab.rb
文件,设置外部URL:sudo nano /etc/gitlab/gitlab.rb
找到 external_url 'http://your_server_ip'
,修改为你的服务器IP地址或域名。sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload
git init
git remote add origin http://your_server_ip/username/project-name.git
克隆项目:
git clone http://your_server_ip/username/project-name.git
添加文件:
cd project-name
git add .
提交更改:
git commit -m "Initial commit"
推送更改:
git push origin master
分支管理:
git branch new-feature
git checkout new-feature
git checkout master
git merge new-feature
git push origin master
标签管理:
git tag -a v1.0 -m "Release version 1.0"
git push origin v1.0
合并请求:
通过以上步骤,你可以在Linux系统上使用GitLab进行版本控制。GitLab提供了丰富的功能和灵活的配置选项,可以根据你的需求进行调整。