怎么更换掉远程仓库的地址(已实战)
origin 已经存在,所以不能用 git remote add 再添加。要修改已有远程仓库地址,用 git remote set-url。
推荐这样做:
git remote set-url origin https://gitee.com/linjun873540969/video-replication-software.git
然后确认一下:
git remote -v
应该会看到:
origin https://gitee.com/linjun873540969/video-replication-software.git (fetch)
origin https://gitee.com/linjun873540969/video-replication-software.git (push)
如果你想先删掉原来的 origin,再重新添加,也可以:
git remote remove origin
git remote add origin https://gitee.com/linjun873540969/video-replication-software.git
之后推送代码:
git push -u origin master
如果你的主分支叫 main,就用:
git push -u origin main
总结:
git remote add是新增远程仓库git remote set-url是修改已有远程仓库地址- 报错
remote origin already exists就是因为origin已经存在了

浙公网安备 33010602011771号