gitlab代码迁移,包含历史提交记录、标签、分支

1、克隆现有的GitLab仓库(http://localhost:8888/aa/bb/cc.git)到本地,包括所有分支和标签

复制代码
git clone --bare http://localhost:8888/aa/bb/cc.git

2、在gitlab上创建一个空的仓库(http://localhost:7777/aa/bb/cc.git

复制代码
//切换到cc目录下,
cd cc.git/

//-f为强制推送
git push -f --mirror http://localhost:7777/aa/bb/cc.git

3、问题:

如果推送时报错,则应该是分支受保护了

复制代码
第一种:! [rejected]        master -> master (fetch first)
第二种:! [rejected]        master -> master (non-fast-forward)
第三种:! [remote rejected] master -> master (pre-receive hook declined)

解决,在设置->仓库->允许强制推送勾选后,再执行第二步

4、切换新仓库

复制代码
git remote set-url origin http://localhost:7777/aa/bb/cc.git
相关推荐
Aliex_git6 天前
Dockerfile 优化实践笔记
笔记·学习·gitlab
成为你的宁宁7 天前
Jenkins 自动化部署前后端分离若依项目全攻略:涵盖环境配置、Maven/Node.js 工具安装、GitLab 项目协同,及前后端构建、服务器推送与代码更新验证全步骤
node.js·自动化·gitlab·jenkins·maven
sunshinebo7 天前
一次 GitLab 无法启动的排查:Docker 日志把 500G 磁盘打满
docker·eureka·gitlab
何以不说话7 天前
DevOps、Git 和 GitLab
git·gitlab·devops
ZAEQgyKFs10 天前
永磁同步电机模型预测电流控制+滑模控制 [1]速度环采用滑模控制 滑模控制器采用新型趋近律与扰...
gitlab
马克Markorg10 天前
使用 Docker Compose 本地部署 GitLab 教程
docker·容器·gitlab
大尚来也13 天前
CI/CD 流水线搭建实战:GitHub Actions vs GitLab CI 2026 深度对比与选型指南
ci/cd·gitlab·github
ProgramHan14 天前
github、gitlab、gitee分别都是什么,为什么不能访问?
gitee·gitlab·github
Aliex_git16 天前
Gitlab Runner 配置实践
笔记·学习·ci/cd·gitlab
阿莫西林夹馍16 天前
GitLab的IP地址发生变更导致Runner掉线
gitlab