1.远程下载gitlab包
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/xenial/gitlab-ce_12.1.4-ce.0_amd64.deb/download.deb
2.本地安装
dpkg -i gitlab-ce_12.1.4-ce.0_amd64.deb
3.修改gitlab.rb配置
vim /etc/gitlab/gitlab.rb
4.修改GitLab URL
## GitLab URL ##! URL on which GitLab will be reachable. ##! For more details on configuring external_url see: ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab external_url 'http://192.168.1.1:8000'
5.直接在本地输入你的external_url
6.输入新密码后,登录
7.完成
1.主界面点击Create a group,创建私有组,只有组内的成员可以看到项目
2.在Groups下点击Members
3.添加用户界面
4.设置用户权限
权限说明:
Guest:可以创建issue,发表评论,不能读写版本库
Reporter:可以克隆代码,不能提交,QA、PM可以赋予这个权限
Developer:可以克隆代码,开发,提交,push,普通开发可以授予该权限
Maintainer:可以创建项目,添加tag,保护分支,添加项目成员,编辑项目,核心开发可以授予该权限
Owner:可以设置值项目访问权限,Visibility Level,删除项目,迁移项目,管理组成员,开发组组长可以授予该权限
gitlab常用指令
常用命令 | 说明 |
sudo gitlab-ctl reconfigure | 重新加载配置,每次修改/etc/gitlab/gitlab.rb文件之后执行 |
sudo gitlab-ctl status | 查看 GitLab 状态 |
sudo gitlab-ctl start | 启动 GitLab |
sudo gitlab-ctl stop | 停止 GitLab |
sudo gitlab-ctl restart | 重启 GitLab |
sudo gitlab-ctl tail | 查看所有日志 |
sudo gitlab-ctl tail nginx/gitlab_acces.log | 查看 nginx 访问日志 |
sudo gitlab-ctl tail postgresql | 查看 postgresql 日志 |
1.New Project
2.添加项目属性
3.新建项目仓库成功
下载git,然后在需要上传的项目文件夹上右键点击Git Bash Here
在这里敲下git命令,具体命令在第五点
您还可以按照以下说明从计算机中上传现有文件。
Git 全局设置
git config --global user.name "XX" git config --global user.email "XXX@163.com"
创建一个新仓库
git clone http://192.168.1.117:8000/deeplearning/deeplab.git cd deeplab touch README.md git add README.md git commit -m "add README" git push -u origin master
推送现有文件夹
cd existing_folder git init git remote add origin [http://192.168.1.117:8000/deeplearning/deeplab.git](http://192.168.1.117:8000/deeplearning/deeplab.git) git add . git commit -m "Initial commit" git push -u origin master
推送现有的 Git 仓库
cd existing_repo git remote rename origin old-origin git remote add origin http://192.168.1.117:8000/deeplearning/deeplab.git git push -u origin --all git push -u origin --tags
1.在master分支上New branch新建分支
2.合并分支
3.源分支为当前分支,目标分支默认为master,确认无误,点击提交
1.在gitlab上点击commits,查看并复制需要回滚的版本序列号
(此操作在Git Bash进行)
2.将本地文件回滚
$ git reset --hard 5a572cb964f1713d4cc24b8dd86e0e70e7eb9e18
3.将服务器代码回滚
$ git push -f
1.更改备份数据生成目录
默认会在/var/opt/gitlab/backups目录下创建tar压缩包
修改 /etc/gitlab/gitlab.rb里的Backup Settings
然后重载一下配置文件
gitlab-ctl reconfigure
2.创建备份文件
gitlab-rake gitlab:backup:create
切换到backups目录查看生成的tar包
3.数据恢复
(1)将备份文件权限修改为777,进行文件解压
chmod 777 1659009687_2022_07_28_12.1.4_gitlab_backup.tar
(2)停止数据连接服务
gitlab-ctl stop unicorn gitlab-ctl stop sidekiq
(3)进行数据恢复
gitlab-rake gitlab:backup:restore BACKUP=1659009687_2022_07_28_12.1.4
实验环境:ubuntu20.04
搜索gitlab镜像
docker search gitlab
创建容器
docker run -d -p 443:443 -p 8000:80 \ --name gitlab \ --restart always \ --privileged=true \ -v /srv/gitlab/config:/etc/gitlab \ -v /srv/gitlab/logs:/var/log/gitlab \ -v /srv/gitlab/data:/var/opt/gitlab \ -v /etc/localtime:/etc/localtime:ro \ gitlab/gitlab-ce
访问gitlab
http://主机IP:8000
如果觉得博客文章对您有帮助,异或土豪有钱任性,可以通过以下扫码向我捐助。也可以动动手指,帮我分享和传播。您的肯定,是我不懈努力的动力!感谢各位亲~