一条命令同时更新多个远程仓库
一条命令将当前分支同时更新到两个远程仓库,直接在origin中添加一个url来实现一个本地仓库多个远程仓库。
git remote set-url --add origin https://gitee.com/Bwar/Nebula.git
执行这条命令后.git/config内容变成:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/Bwar/Nebula.git
url = https://gitee.com/Bwar/Nebula.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "mirror"]
url = https://gitee.com/Bwar/Nebula.git
fetch = +refs/heads/*:refs/remotes/mirror/*
之前添加的“mirror”留着或删掉都没关系,这时候我们一条命令即可更新两个远程仓库:
git push origin master