更改 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)