如何完整遷移git倉庫到另一個遠端地址

Lizzy0077發表於2018-08-08

專案中遇到git倉庫遷移,很常見。如何把一個專案中所有的分支,tag等遷移到另一個倉庫地址,需要執行一個特別的克隆命令,然後映象push到新的倉庫地址。具體步驟如下:
1.開啟命令列工具
2.以bare的方式克隆老的倉庫

git clone --bare https://github.com/exampleuser/old-repository.git

3.映象push到新的倉庫地址

cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git

4.在電腦中刪掉老得倉庫,把新的倉庫重新拉下來

cd ..
rm -rf old-repository.git

原文連結

相關文章