git 仓库迁移
场景1:git仓库无lfs
仓库地址 | |
---|---|
旧仓库地址 | http://gitee.com/original/git_repository.git |
目标仓库地址 | http://gitee.com/target/git_repository.git |
迁移命令
git clone --bare http://gitee.com/original/git_repository.git
cd git_repository.git
git push --mirror http://gitee.com/target/git_repository.git
样例如下:
cxloge@DESKTOP-HPL3DI2 MINGW64 ~/Desktop/git_move
$ git clone --bare http://gitee.com/original/git_repository.git
Cloning into bare repository 'RaspberryPi4.git'...
remote: Enumerating objects: 342, done.
remote: Counting objects: 100% (342/342), done.
remote: Compressing objects: 100% (317/317), done.
remote: Total 342 (delta 51), reused 179 (delta 19), pack-reused 0
Receiving objects: 100% (342/342), 19.11 MiB | 3.78 MiB/s, done.
Resolving deltas: 100% (51/51), done.
cxloge@DESKTOP-HPL3DI2 MINGW64 ~/Desktop/git_move
$ cd git_repository.git
cxloge@DESKTOP-HPL3DI2 MINGW64 ~/Desktop/git_move/git_repository.git (BARE:master)
$ git push --mirror http://gitee.com/target/git_repository.git
Enumerating objects: 342, done.
Counting objects: 100% (342/342), done.
Delta compression using up to 4 threads
Compressing objects: 100% (285/285), done.
Writing objects: 100% (342/342), 19.11 MiB | 887.00 KiB/s, done.
Total 342 (delta 51), reused 342 (delta 51), pack-reused 0
remote: Resolving deltas: 100% (51/51), done.
remote: Powered by GITEE.COM [GNK-6.4]
To http://gitee.com/target/git_repository.git
* [new branch] master -> master
场景2:git lfs仓库迁移
仓库地址 | |
---|---|
旧仓库地址 | http://gitee.com/original/git_lfs_repository.git |
目标仓库地址 | http://gitee.com/target/git_lfs_repository.git |
git clone --bare http://gitee.com/original/git_lfs_repository.git
cd git_lfs_repository.git
git lfs fetch --all #将 LFS 的文件都下载到本地
git remote add origin-target http://gitee.com/target/git_lfs_repository.git
git lfs push --all origin-target # 推送 LFS 文件到origin-target
git push --mirror origin-target
样例如下:
待后续补充
标签:git,http,repository,仓库,gitee,342,迁移,com
From: https://www.cnblogs.com/cxloge/p/17206185.html