Git提交到多個遠程倉庫


例如我有下面兩個倉庫:
https://gitee.com/zkzong/mongodb.git
https://github.com/zkzong/mongodb.git

先添加第一個倉庫:
git remote add origin https://gitee.com/zkzong/mongodb.git
再添加第二個倉庫:
git remote set-url --add origin https://github.com/zkzong/mongodb.git

如果還有其他,則可以像添加第二個一樣繼續添加其他倉庫。

然后使用下面命令提交:
git push origin --all

打開.git/config,可以看到這樣的配置:

[remote "origin"]
url = https://github.com/zkzong/spring-boot.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://gitee.com/zkzong/spring-boot.git

  

剛才的命令其實就是添加了這些配置。如果不想用命令行,可以直接編輯該文件,添加對應的url即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM