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
相关推荐
极小狐1 小时前
极狐GitLab 的合并请求部件能干什么?
运维·git·安全·gitlab·极狐gitlab
极小狐10 小时前
极狐GitLab 议题权重有什么作用?
开发语言·数据库·chrome·c#·gitlab
极小狐11 小时前
极狐GitLab 的压缩和合并是什么?
运维·git·ssh·gitlab·github
极小狐18 小时前
极狐GitLab 合并请求依赖如何解决?
运维·git·ssh·gitlab·github
极小狐2 天前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab
宁酱醇2 天前
GitLab_密钥生成(SSH-key)
运维·ssh·gitlab
极小狐2 天前
极狐GitLab 如何 cherry-pick 变更?
人工智能·git·机器学习·gitlab
云攀登者-望正茂2 天前
60个GitLab CI/CD 面试问题和答案
ci/cd·gitlab·devops
懿瑾2 天前
GitLab Auth2授权-Express + passport-gitlab2
gitlab·angular.js
zhang23839061543 天前
IDEA add gitlab account 提示
java·gitlab·intellij-idea·idea