git仓库搬家

1). 从原地址克隆一份裸版本库

git clone --bare git://github.com/username/test.git

2). 然后到新的 Git 服务器上创建一个新项目

3). 以镜像推送的方式上传代码到 新的 服务器上

cd test.git

git push --mirror [email protected]/username/test.git

4). 删除本地代码

cd ..

rm -rf test.git

5). 到新服务器上找到 Clone 地址,直接 Clone 到本地

git clone [email protected]/username/test.git

注: 这种方式可以保留原版本库中的所有内容

你可能感兴趣的:(git仓库搬家)