Git库迁移

10 阅读1分钟

1.收到等待迁移的Git库代码完整打包,包解压后会有“project.bundle”、“project.json”、“VERSION”三个文件

2.在解压后的目录下执行

mkdir my-new-repo 
cd my-new-repo 
git init

3.一次性把 bundle 内所有分支、标签拉成本地实体分支

git fetch ../project.bundle refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*

4.以阿里去为接收方举例,创建一个空仓库,不勾选“README”和“.gitignore”

5.推送到阿里云

 git remote add aliyun <你的阿里云仓库URL> 
 
 # 推送所有分支和标签(完整迁移) 
 git push aliyun --all 
 git push aliyun --tags