git迁移仓库

查看:103
本文介绍了git迁移仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

想把git的远端仓库迁移到另外一个新的仓库,如何完整迁移(包含所有的分支,而不是仅仅master)?
使用下面这种方式克隆裸版本库然后push只有master分支,请问各位大虾有没有什么简单方法能一次把仓库里的所有分支都clone过去(远端仓库分支比较多)。
git clone --bare git://github.com/username/project.git
git push --mirror git@gitcafe.com/username/newproject.git

解决方案

镜像克隆:

git clone --mirror  https://github.com/../old.git old.git
cd old.git

然后推送镜像:

git remote set-url --push origin git@gitcafe.com/.../new.git
git push --mirror

或者推送新建remote再推送:

git remote add mirror origin git@gitcafe.com/.../new.git
git push mirror --all
git push mirror --tags

这篇关于git迁移仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆