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
相关推荐
lisanmengmeng18 小时前
gitlab 免密配置
linux·服务器·gitlab
求知若渴,虚心若愚。20 小时前
Jenkins 自动化流水线(CICD)
运维·自动化·gitlab
mnasd3 天前
Gitlab + Jenkins 实现 CICD
运维·gitlab·jenkins
鹤鸣的日常3 天前
前端运行时动态环境变量方案
前端·react.js·docker·前端框架·vue·gitlab
starvapour4 天前
Ubuntu部署gitlab频繁出现502的问题
linux·ubuntu·gitlab
开发者联盟league4 天前
使用Jenkins整合Sonarqube/Gitlab/Harbor/Kubernetes的Demo工程
kubernetes·gitlab·jenkins
开发者联盟league4 天前
使用Jenkins整合Sonarqube/Gitlab/Harbor/Kubernetes实现CICD
kubernetes·gitlab·jenkins
zyl837214 天前
前后端项目自动部署方案主流实现方案
ci/cd·gitlab·github
tingting01195 天前
Anolis OS release 8.10安装gitlab
gitlab
shchojj5 天前
gitlab推送触发jekins编译
运维·gitlab