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
相关推荐
妮妮分享2 小时前
维智定位 Android 定位 SDK
gitee
qianmoQ3 小时前
GitHub 趋势日报 (2025年05月14日)
github
ice___Cpu6 小时前
Git - 1( 14000 字详解 )
大数据·git·elasticsearch
Yvonne爱编码6 小时前
CSS- 2.1 实战之图文混排、表格、表单
前端·css·html·github·状态模式·html5·hbuilder
qianmoQ16 小时前
GitHub 趋势日报 (2025年05月11日)
github
Yvonne爱编码17 小时前
HTML-3.3 表格布局(学校官网简易布局实例)
前端·html·github·html5·hbuilder
范纹杉想快点毕业21 小时前
以项目的方式学QT开发(一)——超详细讲解(120000多字详细讲解,涵盖qt大量知识)逐步更新!
c语言·数据结构·c++·git·qt·链表·github
qq_653644461 天前
如何查看打开的 git bash 窗口是否是管理员权限打开
开发语言·windows·git·bash
tonngw1 天前
【Mac 从 0 到 1 保姆级配置教程 12】- 安装配置万能的编辑器 VSCode 以及常用插件
git·vscode·后端·macos·开源·编辑器·github
八股文领域大手子1 天前
HTTP/1.1 host虚拟主机详解
github