无限星辰工作室-客户无限互联网动力之源

标题: Gitlab 使用常用问题 [打印本页]

作者: crx349    时间: 2019-1-12 03:09
标题: Gitlab 使用常用问题
1.上传项目正确姿势

  1. cd xmspace
  2. git init
  3. git remote add origin http://git.xmspace.net/crx349/xmspace.git
  4. git add .
  5. git commit -m "init files"
  6. git push -u origin master
复制代码


2.修改gitlab为绑定域名
打开
  1. vi /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
复制代码

修改 host为域名
  1. ## GitLab settings
  2.   gitlab:
  3.     ## Web server settings (note: host is the FQDN, do not include http://)
  4.     host: git.xmspace.net
  5.     port: 8099
  6.     https: false
复制代码

重启gitlab
  1. gitlab-ctl restart
复制代码


报错:git operation was rejected by pre-receive hook
/opt/gitlab/embedded/service/gitlab-shell/config.yml
搜索:
  1. gitlab_url: "http://127.0.0.1:8098"
复制代码

改为
  1. gitlab_url: "http://git.xmspace.net"
复制代码

重启gitlab
  1. gitlab-ctl restart
复制代码


换项目存储目录

  1. vi /etc/gitlab/gitlab.rb

  2. # 把注释取消然后指定新的仓库存储位置
  3. git_data_dirs({ "default" => { "path" => "/www/gitlab-data" } })
复制代码


没数据的情况下:
  1. gitlab-ctl stop
  2. gitlab-ctl reconfigure
复制代码

有数据的情况:
  1. gitlab-ctl stop
复制代码
  1. rsync -av /var/opt/gitlab/git-data/repositories /www/gitlab-data/
复制代码

# 注意 'repositories'后面不带斜杠,而
# '/www/gitlab-data'后面是有斜杠的。
  1. gitlab-ctl reconfigure
复制代码

修复
  1. gitlab-ctl start
复制代码

启动gitlab




欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://www.xmspace.net/) Powered by Discuz! X3.4