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
相关推荐
大白要努力!20 小时前
在 Android Studio 中使用 GitLab 添加图片到 README.md
android·gitlab·android studio
星释20 小时前
如何编写GitLab-CI配置文件
ci/cd·gitlab
馨羽的玩具1 天前
gitlab rss订阅失败
gitlab
t198751282 天前
jenkins结合gitlab实现CI
ci/cd·gitlab·jenkins
一颗小豆2 天前
07-接着玩-linux的CD/CI全流程体验
gitlab
乐~~~4 天前
gitLab 切换中文模式
gitlab
炒毛豆4 天前
git 如何解决分支合并冲突(VS code可视化解决+gitLab网页解决)
git·gitlab
m0_555762904 天前
GitLab CI、GitHub Actions和Jenkins进行比较
ci/cd·gitlab·github
☆凡尘清心☆5 天前
Centos7安装gitlab
gitlab