Git变更远程仓库

方法一 通过命令直接修改远程地址

git remote set-url origin [new git url]

方法二 通过命令先删除再添加远程仓库

git remote rm origin
git remote add origin [new git url]

方法三 直接修改配置文件

  • 进入.git/

  • vim config
    [core]
    repositoryformatversion = 0
    filemode = true
    logallrefupdates = true
    precomposeunicode = true
    [remote "origin"]
    url = [old git url]
    fetch = +refs/heads/:refs/remotes/origin/
    [branch "master"]
    remote = origin
    merge = refs/heads/master

  • 修改 [remote “origin”]下面的url即可

你可能感兴趣的:(Git变更远程仓库)