git 添加第二个远程仓库地址


直接通过git remote set-url --add origin添加即可:

itaken@itaken-home:~/path/to/project$ git remote set-url --add origin https://gitee.com/itaken/itaken.git

查看项目的仓库信息:

itaken@itaken-home:~/path/to/project$ git remote -v
origin  https://github.com/itaken/itaken.github.io.git (fetch)
origin  https://github.com/itaken/itaken.github.io.git (push)
origin  https://gitee.com/itaken/itaken.git (push)

如果要删除某个远程地址,则只能全部删除,再单独添加

itaken@itaken-home:~/path/to/project$ git remote rm origin
itaken@itaken-home:~/path/to/project$ git remote -v

itaken@itaken-home:~/path/to/project$ git remote add origin https://github.com/itaken/itaken.github.io.git
itaken@itaken-home:~/path/to/project$ git remote -v
origin  https://github.com/itaken/itaken.github.io.git (fetch)
origin  https://github.com/itaken/itaken.github.io.git (push)

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录