上帝大脸 发表于 2018-9-16 10:47:19

gitlab和git安装

  **gitlab安装 for centos6.***
  添加yum源
  vim /etc/yum.repos.d/gitlab-ce.repo
  
  name=gitlab-ce
  baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
  Enabled=1
  gpgcheck=0
  更新本地yum缓存
  yum makecache
  安装gitlab-ce 社区版
  yum intall gitlab-ce      #自动安装最新版
  yum install gitlab-ce-x.x.x    #安装指定版本
  修改配置文件里面的本机的ip地址(端口可加可不加)
  vim /etc/gitlab/gitlab.rb      # 修改默认的配置文件
  external_url 'http://10.10.10.0:10010'
  保存后,启动服务
  gitlab-ctl reconfigure      # 启动服务
  常用命令:
  gitlab-ctl start    # 启动所有 gitlab 组件;
  gitlab-ctl stop      # 停止所有 gitlab 组件;
  gitlab-ctl restart      # 重启所有 gitlab 组件;
  gitlab-ctl status      # 查看服务状态;
  gitlab-ctl reconfigure      # 启动服务;
  vim /etc/gitlab/gitlab.rb      # 修改默认的配置文件;
  gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
  gitlab-ctl tail      # 查看日志;
  登录GitLab
  在浏览器的地址栏中输入服务器的ip地址(第一次登录需修改root密码)
  git服务器安装配置
  1、安装git
  yum install git -y
  2、添加用户gitrw ,运行git服务
  useradd git
  passwd git
  3、初始化Git仓库
  cd /usr/git_conf
  git init --bare configure.git
  Initialized empty Git repository in /usr/git_conf/sit_git_configure.git/
  chown -R git:git sample.git
  4、禁用shell登录
  出于安全考虑,第二步创建的git用户不允许登录shell,这可以通过编辑/etc/passwd文件完成。找到类似下面的一行:
  git:x:1001:1001:,,,:/home/git:/bin/bash
  改为:
  git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
  这样,git用户可以正常通过ssh使用git,但无法登录shell,因为我们为git用户指定的git-shell每次一登录就自动退出。
  5、克隆远程仓库
  在本地电脑上选择所需的目录执行
  git clone git@10.10.10.0:/usr/git_conf/configure.git
  git帐号是git仓库使用的读写权限帐号
  只读取配置不上传配置的用户使用gitrd用户,克隆命令
  git clone gitrd@10.10.10.0:/usr/git_conf/configure.git
  git学习链接
  https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
  https://www.cnblogs.com/hongdada/p/7573923.html
  https://blog.csdn.net/yanzhenjie1003/article/details/69487932?locationNum=4&fps=1

页: [1]
查看完整版本: gitlab和git安装