1.运维管理

查看版本

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

实时查看日志

gitlab-ctl tail

数据库关系升级

gitlab-rake db:migrate

清理redis缓存

gitlab-rake cache:clear

升级GitLab-ce 版本

yum update gitlab-ce

升级PostgreSQL最新版本

gitlab-ctl pg-upgrade

2.服务控制命令

启动/停止/重启所有 gitlab 组件:

gitlab-ctl start/stop/restart

启动指定模块组件:

gitlab-ctl start redis/postgresql/gitlab-workhorse/logrotate/nginx/sidekiq/unicorn

停止指定模块组件:

gitlab-ctl stop 模块名

查看服务状态

gitlab-ctl status

生成配置并启动服务

gitlab-ctl reconfigure

3.日志相关

实时查看所有日志

gitlab-ctl tail

实时各个模块日志

gitlab-ctl tail redis/postgresql/gitlab-workhorse/logrotate/nginx/sidekiq/unicorn

4.远程仓库相关命令

设置提交代码时的用户信息:

$ git config --global user.name "witvir"
$ git config --global user.email witvir@qq.com

如果去掉 --global 参数只对当前仓库有效。

# 检出仓库
git clone git://github.com/jquery/jquery.git

# 查看远程仓库
git remote -v

# 添加远程仓库
git remote add [name] [url]

# 删除远程仓库
git remote rm [name]

# 修改远程仓库
git remote set-url [name] [newUrl]
git remote set-url --push [name] [newUrl]

# 修改远程仓库名称:比如将origin修改为new origin,可以使用git remote rename命令。
git remote rename [old name] [new name]
git remote rename origin ahome

# 拉取远程仓库
git pull [远程名] [本地分行名称]
git pull https://github.com/torvalds/linux.git

# 推送远程仓库
git push [远程名] [本地分行名称]

# 推送所有标签远程存储库
git push [远程仓库名] --tags

# 提交本地test分支作为远程的master分支
git push origin test:master

# 提交本地test分支作为远程的test分支
git push origin test:test

# 列出分支
git branch

# 修改分支名git branch -m 旧名字 新名字
git branch -m main master

# 查看标签
git tag

# 新建标签
git tag -a <tagname> -m "runoob.com标签"

# git tag 新tag名称 旧tag名称
git tag v1.0 v2.0

# 删除标签
git tag -d 标签名

# 将所有远程标签拉取到本地
git fetch --tags