由于GitLab版本升级麻烦,仓库项目配置较少,于是重新安装配置。
新服务器Linux版本为Alibaba Cloud Linux 3,需要下载el8版本的GitLab。
下载地址
https://packages.gitlab.com/app/gitlab/gitlab-ce/search
下载
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-16.4.3-ce.0.el8.x86_64.rpm/download.rpm
安装依赖
yum install perl
安装GitLab
rpm -ivh gitlab-ce-16.4.3-ce.0.el8.x86_64.rpm
修改配置文件 /etc/gitlab/gitlab.rb
# 把网址改为服务器公网IP(默认IP为80,若80已经使用,自定义其它端口)
external_url 'http://x.x.x.x'
重新加载并启动
gitlab-ctl reconfigure
若结果显示“ruby_block[supervise_redis_sleep] action run”,则会一直卡无法往下进行,这时需要按住“CTRL+C”强制结束,然后运行命令“sudo systemctl restart gitlab-runsvdir”,最后再次执行命令“sudo gitlab-ctl reconfigure”。
重启
gitlab-ctl restart
访问
上述配置的网址
http://x.x.x.x
root账号密码
Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
修改root密码
当前密码为上面/etc/gitlab/initial_root_password
中的密码
修改本地项目远端地址
# 查看远程仓库的地址
git remote -v
# 更换远程仓库地址,URL为新地址
git remote set-url origin URL
推送本地项目到远端,需要项目用户权限为Maintainer
git push -u origin --all
参考
https://zhuanlan.zhihu.com/p/534078400?utm_id=0