方式一

从原地址克隆一份裸版本库,比如原本托管于 GitHub,或者是本地的私有仓库

git clone --bare git://192.168.10.XX/git_repo/project_name.git

以镜像推送的方式上传代码到 新服务器上。
请确保已经添加了公钥到新的机器上

cd project_name.git
git push --mirror git@192.168.20.XX/path/to/path/new_project_name.git
方式二

假设你的remote是origin,用git remote set_url 更换地址

git remote set-url origin remote_git_address

然后用 git push 进行提交

git push  

不过这种只会迁移当前分支到新的git上

其他

详见 git仓库迁移的两种解决方案

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐