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

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

此时更换后没有对远端的仓库进行关联,需要手动对其进行关联
git push --set-upstream origin master 即可本地分支关联到远程主分支
或
git branch --set-upstream-to <remote-branch>

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

你可能感兴趣的:(Git,git,elasticsearch,大数据)