Git 重新关联远程仓库地址的三种方法

  • Post author:
  • Post category:其他


1.修改命令

#查看关联的远程仓库
git remote -v

git remote set-url origin [url] 

例:git remote set-url origin gitlab@yang/BarUtils.git

2.先删后加

git remote rm origin 
git remote add origin [url]

例:git remote add origin gitlab@yang/BarUtils.git

3.直接修改.git文件夹下的config文件

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[submodule]
    active = .
[remote "origin"]
    url = https://github.com/yang/BarUtils.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master