保存时间:2026/4/3 07:43:17
git remote set-url 命令,具体操作如下:git remote set-url <远程仓库名称> <新的URL>
origin,现在要将其 URL 修改为新的地址:git remote -v
origin https://github.com/old-URL/repo.git (fetch)
origin https://github.com/old-URL/repo.git (push)
git remote set-url origin https://github.com/new-URL/repo.git
git remote -v
origin https://github.com/new-URL/repo.git (fetch)
origin https://github.com/new-URL/repo.git (push)
fetch 和 push 两个方向的 URL,可以通过 --push 或 --fetch 参数单独修改:git remote set-url --push origin https://github.com/new-push-URL.git
git remote set-url --fetch origin https://github.com/new-fetch-URL.git
git remote remove origin
git remote add origin <新的URL>