git xxx --mirror 参数说明
Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.
建立一个源码库的镜像。含义类似于 --bare。相比 --bare,–mirro不只是将 源本地分支映射到目标本地分支,实际上映射了所有的引用refs(包括remote-tracking分支,注释等)并且建立指定性引用refspec 配置,即是说通过这次git远程更新,目标仓库的所有引用refs都会被覆盖
Git工具进行仓库迁移
- 克隆整个旧代码库
$ git clone --mirror http://域名/分组/仓库名称.git
- 当前目录切换到代码库
$ cd 仓库名称.git
- 提交代码库到新服务