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
相关推荐
rustfs19 小时前
GitLab 如何与 RustFS 集成?
分布式·rust·gitlab
郝亚军3 天前
gitlab常用命令
gitlab
xixingzhe26 天前
Java 使用 GitLab4J 实现 WebHook
gitlab
童槿顏丶7 天前
GitLab部署到Linux
linux·运维·gitlab
InfinitePlus8 天前
Gitlab docker版本安装
docker·容器·gitlab
进击切图仔8 天前
GitLab 新用户创建与项目授权操作指南
gitlab
技术小结-李爽9 天前
【工具】git与gitee和gitlab和github等等有什么区别?
git·gitee·gitlab
xiaoxiangsiyan10 天前
GitLab CI/CD 自托管(EE 企业版)+ Kubernetes Runner 集群 + ArgoCD(GitOps 部署)
运维·网络·ci/cd·容器·kubernetes·gitlab·argocd
csdn2015_17 天前
vscode从gitlab拉项目到本地
vscode·gitlab
AOwhisky20 天前
AI审AI:GitLab上线AI代码审查,开发者可以松一口气了吗?
人工智能·gitlab