Git提交到多个远程仓库

本文介绍了如何使用Git命令行将本地提交同时推送到多个远程仓库。通过`git remote add`和`git remote set-url --add`命令,可以轻松管理并一次性推送至如GitHub和GitOSC等不同平台的仓库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

可以看这篇文章 http://stackoverflow.com/questions/5785549/able-to-push-to-all-Git-remotes-with-the-one-command

一、通过命令行进行操作

例如我有下面两个仓库:

Mybatis通用Mapper

https://git.oschina.net/Spring/Spring-Boot.git

https://github.com/Spring/Spring-Boot.git

https://git.oschina.net/free/Mapper.git

https://github.com/abel533/Mapper.git

在项目路径下打开Git Bash Here

输入:git remote add all https://git.oschina.net/Spring/Spring-Boot.git

再添加另一个:git remote set-url --add all https://github.com/Spring/Spring-Boot.git

如果有多个,按照上面这一个命令进行添加.

提交的时候输入:git push all --all



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值