crx349 发表于 2019-1-12 03:09:12

Gitlab 使用常用问题

1.上传项目正确姿势

cd xmspace
git init
git remote add origin http://git.xmspace.net/crx349/xmspace.git
git add .
git commit -m "init files"
git push -u origin master

2.修改gitlab为绑定域名
打开
vi /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
修改 host为域名
## GitLab settings
gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: git.xmspace.net
    port: 8099
    https: false

重启gitlab
gitlab-ctl restart

报错:git operation was rejected by pre-receive hook
/opt/gitlab/embedded/service/gitlab-shell/config.yml
搜索:
gitlab_url: "http://127.0.0.1:8098"
改为
gitlab_url: "http://git.xmspace.net"
重启gitlab
gitlab-ctl restart

换项目存储目录

vi /etc/gitlab/gitlab.rb

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

没数据的情况下:
gitlab-ctl stop
gitlab-ctl reconfigure
有数据的情况:
gitlab-ctl stop
rsync -av /var/opt/gitlab/git-data/repositories /www/gitlab-data/
# 注意 'repositories'后面不带斜杠,而
# '/www/gitlab-data'后面是有斜杠的。
gitlab-ctl reconfigure
修复
gitlab-ctl start
启动gitlab
页: [1]
查看完整版本: Gitlab 使用常用问题