GIt 同时绑定 GItee 与 Github 进行 push 操作

1 GIt 同时绑定 GItee 与 Github 进行 push 操作

1) 查看远程仓库

查看下当前项目的远程仓库

git 复制代码
git remote

查看绑定的远程仓库

该命令会显示读写远程仓库的名称和地址,指向仓库为 Github。

cmd 复制代码
git remote -v
>>>
origin  https://github.com/yanSir/demos.git (fetch)
origin  https://github.com/yanSir/demos.git (push)

2) 远程仓库重命名

修改远程仓库名称

cmd 复制代码
git remote rename <old_remote> <new_remote>
git remote rename origin github

查看远程仓库

cmd 复制代码
git remote -v
>>>
github  https://github.com/gozhuyinglong/blog-demos.git (fetch)
github  https://github.com/gozhuyinglong/blog-demos.git (push)

3) 添加另一个远程仓库

添加远程仓库命令

添加Gitee上的远程仓库,在Gitee上创建一个同名的仓库,在【克隆】处复制地址。

cmd 复制代码
git remote add <remote> <url>
git remote add gitee https://gitee.com/gozhuyinglong/blog-demos.git
>>>
gitee   https://gitee.com/gozhuyinglong/blog-demos.git (fetch)
gitee   https://gitee.com/gozhuyinglong/blog-demos.git (push)
github  https://github.com/gozhuyinglong/blog-demos.git (fetch)
github  https://github.com/gozhuyinglong/blog-demos.git (push)

4) 多个远程仓库的推送/拉取

多个远程仓库 push 与 pull 的命令

cmd 复制代码
git push <remote> <branch>、git pull <remote> <branch>:
git push github main
git pull github main
git push gitee main
git pull gitee main

5) 移除一个远程仓库

移除远程仓库命令

执行移除远程仓库后,该仓库在本地的所有分支与配置信息也会一并删除。

cmd 复制代码
git remote remove <remote> | git remote rm <remote>
git remote remove gitee
相关推荐
naice32 分钟前
我对github的图片很不爽了,于是用AI写了一个图片预览插件
前端·javascript·git
逛逛GitHub6 小时前
飞书多维表“独立”了!功能强大的超出想象。
人工智能·github·产品
会飞的青蛙7 小时前
GIT 配置别名&脚本自动化执行
前端·git
努力的小雨8 小时前
混元开源之力:spring-ai-hunyuan 项目功能升级与实战体验
后端·github
NocoBase8 小时前
GitHub 上 Star 数量前 10 的开源项目管理工具
开源·github·资讯
绝无仅有9 小时前
面试实战总结:数据结构与算法面试常见问题解析
后端·面试·github
绝无仅有9 小时前
Docker 面试常见问题及解答
后端·面试·github
逛逛GitHub1 天前
斩获 2 万多 Star!国外老哥把全网 n8n 工作流都开源了
github·工作流引擎
杨杨杨大侠1 天前
Atlas Mapper 案例 01:初级开发者 - 电商订单系统开发
java·开源·github
绝无仅有1 天前
后端 Go 经典面试常见问题解析与总结
后端·面试·github