这是我当前的设置
FDMBA:EnglishStudy willentriken$ git remote -v
origin <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f4869b9b80b49091829198da849c9b86da9a9180" rel="noreferrer noopener nofollow">[email protected]</a>:~/repos/echo.git (fetch)
origin <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="790b16160d391d1c0f1c15570911160b57171c0d" rel="noreferrer noopener nofollow">[email protected]</a>:~/repos/echo.git (push)
但是我们将服务器的主机名从 devel.phor.net 更改为其他名称。我可以“重新指向”我的本地 git 存储库以指向这个新服务器地址,而不会丢失我拥有的任何本地提交等吗?
最佳答案
是的,只需使用set-url
命令
git remote set-url origin root@newhost:repo/echo.git
可以看到结果
git remote -v
origin root@newhost:repo/echo.git (fetch)
origin root@newhost:repo/echo.git (push)
关于git远程服务器移动,如何更新工作副本配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13577181/