git仓库迁移

最近,装了git的本地服务器坏掉了, 没办法只能临时进行仓库的迁移  保证项目正常进行

在项目的根目录执行右键执行

查询当前仓库的远程地址

  git remote -v 查看现有远程仓库的地址url

 

修改及添加远程地址
  1.修改命令  git remote set-url origin URL  更换远程仓库地址,把URL更换为新的url地址

  2.先删后加

    git remote rm origin
    git remote add origin remote_git_address(remote_git_address为新服务器gitLab上新建的同名项目地址)

重新添加要提交的文件(项目)

       git add .

将文件推送到分支上去

  git push origin --all 推送主干和分支

  git push --tags 推送标签

https://www.jianshu.com/p/712ed12d599c

https://www.cnblogs.com/xhf-wonder/p/6728967.html

原文地址:https://www.cnblogs.com/xxj0316/p/9842712.html