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
相关推荐
向往风的男子15 小时前
【devops】devops-gitlab之部署与日常使用
运维·gitlab·devops
soaring012115 小时前
Gitlab实现多项目触发式自动CICD
pipeline·gitlab·triggers·access tokens
cn_newer1 天前
gitlab/极狐-离线包下载地址
gitlab·devops·极狐·离线包下载
Roc-xb2 天前
Centos7安装gitlab-ce(rpm安装方式)
centos·gitlab
慕羽★3 天前
Git常用指令整理【新手入门级】【by慕羽】
linux·git·ubuntu·gitlab·github·仓库·分布式协作
心之所想,行之将至3 天前
记录一下gitlab社区版的安装教程
linux·服务器·gitlab
极小狐3 天前
2024 年 GitLab Global DevSecOps 报告解读
gitlab·devsecops·devops·极狐gitlab·安全合规
极小狐3 天前
极狐GitLab DevSecOps 功能合集(七大安全功能)
安全·gitlab·devsecops·极狐gitlab·安全合规
iRayCheung3 天前
Gitlab pre-receive hooks适配java p3c-pmd和python pycodestyle
java·python·gitlab·pre-receive
极小狐4 天前
如何用 Helm Chart 安装指定版本的 GitLab Runner?
gitlab·devsecops·devops·极狐gitlab·安全合规