更改 Git 存储库的远程 URL
如果迁移远程存储库,你可能希望这样做。更改远程 URL 的命令是:
git remote set-url
它需要 2 个参数:现有的远程名称(origin, upstream)和 url。
检查你当前的远程网址:
git remote -v
origin https://bitbucket.com/develop/myrepo.git (fetch)
origin https://bitbucket.com/develop/myrepo.git (push)
更改你的远程网址:
git remote set-url origin https://localserver/develop/myrepo.git
再次检查你的远程网址:
git remote -v
origin https://localserver/develop/myrepo.git (fetch)
origin https://localserver/develop/myrepo.git (push)