- 新建 /etc/yum.repos.d/gitlab_gitlab-ce.repo,输入如下内容
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
- 安装
sudo yum install gitlab-ce
- GitLab配置文件修改
vim /etc/gitlab/gitlab.rb
#修改访问地址
external_url 'http://10.2.20.20:9083'
- 启动
#使配置生效
gitlab-ctl reconfigure
#查看服务状态
gitlab-ctl status
- 访问,使用
配置的链接 http://10.2.20.20:9083
- 常用命令
gitlab-ctl start # 启动所有 gitlab 组件;
gitlab-ctl stop # 停止所有 gitlab 组件;
gitlab-ctl restart # 重启所有 gitlab 组件;
gitlab-ctl status # 查看服务状态;
vim /etc/gitlab/gitlab.rb # 修改gitlab配置文件;
gitlab-ctl reconfigure # 重新编译gitlab的配置;
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
gitlab-ctl tail # 查看日志;
gitlab-ctl tail nginx/gitlab_access.log
- Gitlab权限管理
Gitlab用户在组中有五种权限:Guest、Reporter、Developer、Master、Owner
- Guest:可以创建issue、发表评论,不能读写版本库
- Reporter:可以克隆代码,不能提交,QA、PM可以赋予这个权限
- Developer:可以克隆代码、开发、提交、push,RD可以赋予这个权限
- Master:可以创建项目、添加tag、保护分支、添加项目成员、编辑项目,核心RD负责人可以赋予这个权限
- Owner:可以设置项目访问权限 - Visibility Level、删除项目、迁移项目、管理组成员,开发组leader可以赋予这个权限
Gitlab中的组和项目有三种访问权限:Private、Internal、Public
- Private:只有组成员才能看到
- Internal:只要登录的用户就能看到
- Public:所有人都能看到
- 推送已有代码到gitlab
#Push an existing folder
cd existing_folder
git init
git remote add origin git@10.2.20.20:adaivskenan/newrpo.git
git add .
git commit -m "Initial commit"
git push -u origin master
#Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin git@10.2.20.20:adaivskenan/newrpo.git
git push -u origin --all
git push -u origin --tags
- 更新自己fork的仓库
# 下面操作是更新master,如果更新别的分支,要在对应分支操作,
# 比如develop,只需要把下面命令的master全部替换为develop
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
git checkout master
# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:
git rebase upstream/master
# If you've rebased your branch onto upstream/master you may need
# to force the push in order to push it to your own forked repository
git push -f origin master
参考