标签(linux): git

笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流

相关命令

更新代码
  • git pull
将分支再
  • git fetch
  • git push origin master
  • git remote
  • git remote -v
  • git remote show origin
  • git remote rename pb paul
  • git tag -a v1.0 -m 'abc'

gitlab安装配置

安装依赖

yum install curl policycoreutils openssh-server openssh-clients -y
systemctl enable sshd
systemctl start sshd
yum install postfix -y
systemctl enable postfix
systemctl start postfix
RPM安装
从官网是无不下载的,有防火墙挡着
可从清华大学镜像下载:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
rpm -ivh gitlab-ce-8.9.5-ce.0.el7.x86_64.rpm
修改配置文件
vim /etc/gitlab/gitlab.rb
external_url 'your_ip_address'
配置
gitlab-ctl reconfigure
访问

http://your_ip_address

权限

自定义密码

用刚才设置的密码登录

gitlab集成了nginx,redis,数据库等软件

注意:

  • 虚拟机最好为centos7 64位
  • 内存大于2G
  • 安装版本gitlab_ce_9.0.*

gitlab常用命令

  • gitlab-ctl status #查看相关组件
  • gitlab-ctl start #启动
  • gitlab-ctl stop #停止
  • gitlab-ctl restart #重启
  • gitlab-ctl tail nginx #查看nginx的日志

gitlab组件

  • nginx : 静态web服务器
  • gitlab-shell : 用于处理git命令和修改authorized keys列表
  • gitlab-workhorse : 轻量级的反向代理服务器
  • logrotate : 日志文件管理工具
  • postgresql : 数据库
  • redis : 缓存数据库
  • sidekiq : 用于在后台执行队列任务(异步执行)
  • unicorn : gitlab redis 应用是托管在这个服务器上面的。

相关目录

  • /var/opt/gitlab/git-data/repositories/root : 库默认存储目录
  • /opt/gitlab : 应用代码和相应的依赖程序
  • /var/opt/gitlab : gitlab-ctl reconfigure 命令编译后的应用数据和配置文件,不需要人为修改配置
  • /etc/gitlab : 配置文件目录
  • var/log/gitlab : 此目录下存放了gitlab各个组件产生的日志。
  • /var/opt/gitlab/backups/ : 备份文件生成的目录

变更主配置文件

需要以下操作

  • gitlab-ctl reconfigure 重置配置文件
  • gitlab-ctl show-config 验证配置文件
  • gitlab-ctl restart 重启gitlab服务