Git同时推送多个远程仓库

  1. 查看当前的远程仓库

输入

git remote -v
输出

origin ssh://...flutter.git (fetch)

origin ssh://...flutter.git (push)

  1. 添加第二个远程仓库

输入

git remote add github https://github.com/...flutter.git

  1. 查看当前的远程仓库

输入

git remote -v
输出

origin ssh://...flutter.git (fetch)

origin ssh://...flutter.git (push)

github https://github.com/...flutter.git (fetch)

github https://github.com/...flutter.git (push)

  1. 指定推送

git push origin main / git push github main

  1. 同时推送到两个仓库

输入

git remote set-url --add origin https://github.com/...flutter.git

  1. 查看当前的远程仓库

输入

git remote -v
输出

origin ssh://...flutter.git (fetch)

origin ssh://...flutter.git (push)

origin https://github.com/...flutter.git (push)

github https://github.com/...flutter.git (fetch)

github https://github.com/...flutter.git (push)

  1. 推送

输入

git push origin main

此时会推送到两个远程仓库

相关推荐
和你看星星2 天前
Git rerere:让重复冲突只解决一次
git
嘻嘻仙人5 天前
Ubuntu中 git上传自己的项目和二次上传一般流程
git·github
Patrick_Wilson5 天前
Squash Merge 的血缘陷阱:为什么删掉的代码又活了过来
前端·git·程序员
沉浸学习的匿名网友5 天前
什么是 .gitignore?为什么每个 Git 项目几乎都离不开它?
前端·git
深海鱼在掘金6 天前
Git 完全指南 —— 第3章:理解工作区、暂存区、版本库三个核心
git
江华森6 天前
Git 基础筑基:从原理到团队协作的全栈实战
git
JakeJiang7 天前
Git 必备命令指南:从日常高频到项目开发实战
git
叫我少年7 天前
Windows 中安装 git
git
深海鱼在掘金13 天前
Git 完全指南 —— 第1章:Git 概览与版本控制演进
git
noravinsc13 天前
关于Git Flow
git