GitLab安装-Linux
2022/12/26大约 2 分钟
GitLab使用教程
GitLab安装
Gitlab初始密码存放在
/etc/gitlab/initial_root_password`
该密码在首次执行reconfigure后24小时候自动删除。
Gitlab启用开机自启动:
systemctl enable gitlab-runsvdir.service
Gitlab禁止开机自启动:
systemctl disable gitlab-runsvdir.service
GitLab重新配置
gitlab-ctl reconfigure
GitLab重启服务
gitlab-ctl restart
GitLab中启用相对URL
修改 external_url
vim /etc/gitlab/gitlab.rb
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://server.accother.com:8008/gitlab'
重新配置GitLab,使更改生效
gitlab-ctl reconfigure
重启GitLab服务
gitlab-ctl restart
查看url配置是否生效:
cat /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: server.accother.com
port: 80
https: false
......
# WARNING: See config/application.rb under "Relative url support" for the list of
# other files that need to be changed for relative url support
relative_url_root: /gitlab
GitLab修改Puma端口 解决8080端口冲突
GitLab修改clone地址
因为配置了域名访问GitLab,但是在项目clone这里,显示的还是ip地址,并且还带端口。
修改方法:
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

重启GitLab服务(不执行reconfigure否则会被覆盖)
gitlab-ctl restart
GitLab服务器邮箱配置,实现自动发送邮件
GitLab迁移/修改代码仓存放位置
GitLab完全卸载删除
停止Gitlab
gitlab-ctl stop
卸载Gitlab
rpm -e gitlab-ce` or `yum remove gitlab-ce
查看Gitlab进程
ps aux | grep gitlab
杀掉第一个进程,根据上一步结果进行操作
kill -9 进程号
删除所有包含gitlab的文件
find / -n gitlab | xargs rm -rf