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
相关推荐
鼎道开发者联盟16 小时前
鼎享会 | 从手工到自动化:OpenClaw改造GitLab内部协作流程的全过程
自动化·gitlab·openclaw
ℳ₯㎕ddzོꦿ࿐2 天前
告别手工发版:用 GitLab CI/CD 打通前后端自动化部署的“任督二脉”
ci/cd·自动化·gitlab
ℳ₯㎕ddzོꦿ࿐2 天前
实战:在 Linux 系统用 Docker-Compose 优雅部署 GitLab 及防坑指南
linux·docker·gitlab
源图客2 天前
Linux(CentOS9)服务器部署gitlab-ce-18.11.1-ce.0.el9.x86_64.rpm
linux·服务器·gitlab
ℳ₯㎕ddzོꦿ࿐2 天前
实战篇:结合 GitLab CI/CD 实现 Spring Cloud 微服务自动化部署与防坑指南
spring cloud·ci/cd·gitlab
菜萝卜子3 天前
【Git】GitLab 18.9 全局服务器钩子(Server Hooks)官方规范与落地实践
服务器·git·gitlab
lilili也4 天前
Git、VScode、GitLab
git·vscode·gitlab
郭龙_Jack4 天前
Gitlab CICD流水线设计
gitlab
MinterFusion6 天前
如果openKylin 2.0 SP2主机的IPv4地址改变,如何让GitLab正常运行
运维·gitlab·系统配置·系统维护·明德融创
Elivs.Xiang6 天前
ubuntu20中安装gitlab
linux·ubuntu·gitlab