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
相关推荐
修己xj3 小时前
Gogs: 打造属于你自己的轻量级 Git 服务
git
XD7429716364 小时前
科技早报晚报|2026年5月7日:电子签署、团队知识库与可嵌入表格引擎,今天更值得动手的 3 个开源机会
科技·开源·github·开源项目·开发者工具
Mediary5 小时前
Git本地忽略文件夹,只拉取目标文件夹
git
MY_TEUCK9 小时前
【git工具篇】Git 常用实战手册:从基础命令到分支冲突解决(开发实战版)
大数据·git
Rkgua9 小时前
初学者对与.gitignore应该有的了解
github
幸运的大号暖贴10 小时前
解决Vibe Coding时Idea经常不自动git add问题
java·人工智能·git·intellij-idea·claudecode·opencode
darkb1rd11 小时前
deepclaude:低成本指南,17 倍省调用费
开源·github·好物分享
摇滚侠11 小时前
如何打开 GitHub,GitHub 是基于 Git 版本控制系统的在线代码托管平台
git·github
DogDaoDao12 小时前
【GitHub】System Informer:Windows 平台最强开源系统监控与调试利器
windows·程序员·开源·github·开发工具·system informer
MY_TEUCK12 小时前
【Git 实习生小白专用】:最安全、永不翻车、公司最爱 的标准版本控制工作流程
git·安全·github