[h2title]一、更改仓库地址[/h2title]
1、创建新的仓库目录,例如/gitlab/git-data
mkdir /gitlab/git-data2、修改配置文件
vi /etc/gitlab/gitlab.rb按i进入修改模式,找到git_data_dirs,如果注释了,请取消注释,修改结果如下
git_data_dirs({ "default" => { "path" => "/gitlab/git-data" } })然后按esc退出修改模式,输入:wq保存退出,如无权限,请输入:q!退出后再运行
sudo vi /etc/gitlab/gitlab.rb重新修改保存! [h2title] 二 、修改SSH的端口[/h2title] 当SSH的端口号不是22的时候,使用证书的时候无法使用,需要加上端口号
打开/etc/gitlab/gitlab.rb
文件,从文件中找到#gitlab_rails['gitlab_shell_ssh_port']= 22
去掉前面的#号,把端口号22修改为你自己的端口号,比如12345
[h2title]三、运行命令使配置生效[/h2title]
gitlab-ctl reconfigure等待配置文件更新完毕 [dangerbox title="宝塔面板安装的gitlab可能会报如下错误:"]
There was an error running gitlab-ctl reconfigure: Multiple failures occurred: * Mixlib::ShellOut::ShellCommandFailed occurred in Chef Infra Client run: runit_service[nginx] (nginx::enable line 18) had an error: Mixlib::ShellOut::ShellCommandFailed: ruby_block[restart_service] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/libraries/provider_runit_service.rb line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/nginx ---- STDOUT: timeout: down: /opt/gitlab/service/nginx: 0s, normally up, want up STDERR: ---- End output of /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/nginx ---- Ran /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/nginx returned 1 * Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: runit_service[nginx] (nginx::enable line 18) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/nginx ---- STDOUT: timeout: down: /opt/gitlab/service/nginx: 1s, normally up, want up STDERR: ---- End output of /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/nginx ---- Ran /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/nginx returned 1这是因为nginx服务名不同的原因,这时需要如下操作 修改文件/opt/gitlab/sv/nginx/run 把 exec chpst -P /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx 改为 exec chpst -P /opt/gitlab/embedded/sbin/gitlab-web -p /var/opt/gitlab/nginx 然后再次运行 gitlab-ctl restart [/dangerbox]
评论区