Git设置多个仓库同时推送

Git设置多个仓库同时推送

添加

在Git中,有时我们需要将同一份代码推送到不同的远程仓库,只是URL地址不同。

下面是一种优化的方法来设置多个仓库同时推送:

bash 复制代码
# 添加一个新的远程仓库
git remote set-url --add origin2 新的仓库地址

这样,你就可以同时推送代码到多个远程仓库了。

删除

删除全部

如果你想删除一个已经添加的远程仓库所有的地址origin2

bash 复制代码
git remote remove origin2

这样就可以将名为origin2的远程仓库从你的本地仓库中移除了。

删除一个

如果只是想删除其中一个地址,如:

复制代码
origin  https://gitee.com/1 (fetch)
origin  https://gitee.com/2 (push)
origin  http://3 (push)

只需要输入

sh 复制代码
git remote set-url --delete origin http://60.204.230.80:3000/BunnyBBS/web.git
相关推荐
驯龙高手_追风1 小时前
Gitlab本地服务器搭建及配置-详细教程
git·github
czhc11400756632 小时前
6.11:halcon,Sqlserver;项目sql连接;git
git·sql·sqlserver
炸炸鱼.2 小时前
Git+Jenkins 基本使用:从入门到实战(知识点大全)
运维·git·jenkins
戴国进4 小时前
git stash 用法详解
git
木雷双雄75 小时前
Git 版本回退操作指南
git
m0_5791466515 小时前
已被 Git 追踪的本地修改文件如何实现临时忽略
git
糖少主18 小时前
WSL中使用Beyond Compare 3/4/5作为difftool
git·wsl·beyond compare·difftool
console.log('npc')20 小时前
Git版本管控:git reset \+ git push \-f 原理、实操与避坑指南
git
恋喵大鲤鱼1 天前
git reflog
git·git reflog
MatrixOrigin1 天前
MatrixOne Git4Data 技术详解(二):从零跑通所有 Git 原语
git