1.合并代码
102
cd /opt/web1
git checkout develop
页面信息
vim index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Linux01 项目1</title>
</head>
<body>
<h1>Linux01 web1 v5</h1> <--
</body>
</html>
更新、备注
git add ./*
git commit -m "v5"
提交到开发
git push
Username for 'http://192.168.37.101': zhangsan <--
Password for 'http://zhangsan@192.168.37.101': <--密码:1234.com
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 314 bytes | 314.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote:
remote: To create a merge request for develop, visit:
remote: http://192.168.37.101/linux01/web1/merge_requests/new?merge_request%5Bsource_branch%5D=develop
remote:
To http://192.168.37.101/linux01/web1.git
a4cefd4..8ca1d69 develop -> develop
zhangsan
切换到root\管理员
账号
合并提交
合并成功
发布代码
102
cd /opt
rm -rf web1/
git clone -b master http://192.168.37.101/linux01/web1.git
cat web1/index.html
#拷贝到远程主机
scp web1/index.html 192.168.37.105:/data/nginx/html/linux01/
105
可下载到本地继续开发
cd /opt/
#账号:zhangsan 密码:1234.com
git clone -b develop http://192.168.37.101/linux01/web1.git
结果
2. gitlab数据备份恢复
101
- 停止服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
- 备份数据
#在任意目录即可备份当前gitlab数据
gitlab-rake gitlab:backup:create
- 搜索文件所在位置
find / -name *_gitlab_backup.tar
/var/opt/gitlab/backups/1676138023_2023_02_12_12.3.5_gitlab_backup.tar
- 启动服务
gitlab-ctl start
测试能否备份、开始搞破坏、删除或修改一些内容
- 开始恢复、先停止服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
- 再恢复
gitlab-rake gitlab:backup:restore BACKUP=1676138023_2023_02_12_12.3.5
Unpacking backup ... done
Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.
Do you want to continue (yes/no)? yes <--
- 启动服务
gitlab-ctl start
查看是否恢复
数据回来了(还原成功)
3. git汉化
汉化包地址:gitlab.com/xhang/gitla…
3.1 下载语言包替换
101
- 停服务
gitlab-ctl stop
- 备份
(防止汉化包有问题)
cp -rp /opt/gitlab/embedded/service/gitlab-rails /opt/gitlab-rails.bak
- 解压汉化包:Gitlab汉化包
tar xvf gitlab-v12.3.5-zh.tar.gz
- 替换文件
cp -rf gitlab-v12.3.5-zh/* /opt/gitlab/embedded/service/gitlab-rails/
#替换时会出现下面两个报错、不过没关系
cp: cannot overwrite non-directory '/opt/gitlab/embedded/service/gitlab-rails/log' with directory 'gitlab-v12.3.5-zh/log'
cp: cannot overwrite non-directory '/opt/gitlab/embedded/service/gitlab-rails/tmp' with directory 'gitlab-v12.3.5-zh/tmp'
- 重新配置
gitlab-ctl reconfigure
- 启动
gitlab-ctl start
3.2 通过源码汉化
汉化包地址:gitlab.com/xhang/gitla…
cd /usr/local/src/
git clone https://gitlab.com/xhang/gitlab.git
#查看当前gitlab版本(如:gitlab-ce 12.3.5)
head -1 /opt/gitlab/version-manifest.txt
cd gitlab/
git diff v12.3.5 v12.3.5-zh
git diff v12.3.5 v12.3.5-zh > /opt/gitlab-12.3.5.diff
gitlab-ctl stop
#p1表示第一个补丁
patch -f -d /opt/gitlab/embedded/service/gitlab-rails/ -p1 < /opt/gitlab-12.3.5.diff
gitlab-ctl reconfigure
gitlab-ctl start