Heim > Fragen und Antworten > Hauptteil
想把git的远端仓库迁移到另外一个新的仓库,如何完整迁移(包含所有的分支,而不是仅仅master)?
使用下面这种方式克隆裸版本库然后push只有master分支,请问各位大虾有没有什么简单方法能一次把仓库里的所有分支都clone过去(远端仓库分支比较多)。
git clone --bare git://github.com/username/project.git
git push --mirror git@gitcafe.com/username/newproject.git
过去多啦不再A梦2017-05-02 09:41:39
镜像克隆:
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
给我你的怀抱2017-05-02 09:41:39
git clone git://github.com/username/project.git
git push origin
试试
另外,如果是把github的一个仓库移到github另一个账号或小组下,可以用fork
巴扎黑2017-05-02 09:41:39
有管理权限的话直接在管理界面 Transfer 就可以了。
你的 clone 操作是带所有分支的(pr ref 除外)。你的 push 操作只有一个分支而已。