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
相关推荐
xurime6 小时前
Excelize 开源十周年,发布 2.11.0 版本
golang·开源·github·excel·导出·导入·excelize·基础库
霸道流氓气质11 小时前
CodeBuddy中使用 MCP 工具将 XMind 思维导图转换为 Markdown —— 实操流程汇总
git·myeclipse·xmind
逛逛GitHub12 小时前
自测会不会被 Claude Code 标记为中国用户,有人做了个网页。
github
逛逛GitHub12 小时前
终于有个非 AI 相关的项目登上 GitHub 热榜,高低得推荐一下。
github
Lion0914 小时前
【04】50 行代码实现最小 Agent:不依赖任何框架
人工智能·github
OsDepK16 小时前
mimo code安装教程
git·电脑·ai编程
狂炫冰美式16 小时前
凌晨睡不着,我给台风巴威写了个追踪网站
前端·后端·github
Maynor99618 小时前
GitHub 外链 / 自荐入口清单
github
oscar99919 小时前
3.4 Nginx 负载均衡——动态再平衡的反人性纪律
nginx·github·负载均衡·财富源代码
杨超越luckly19 小时前
Agent 应用指南:基于 OurAirports 的中国机场设施数据可视化
python·html·github·可视化·机场设施