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
相关推荐
Zzz 小生16 小时前
Github-Langflow:可视化AI工作流构建平台,让AI应用开发更简单
人工智能·笔记·python·github
草莓熊Lotso16 小时前
企业级 Git 分支管理模型实战:从 Git Flow 到 DevOps 落地
运维·服务器·开发语言·c++·人工智能·git·devops
知行力16 小时前
【GitHub每日速递 20251208】37signals出品Fizzy看板工具:从开发部署到功能配置全揭秘
github
抹茶冰淇淋16 小时前
面对新电脑,前端开发者需要进行哪些初始化配置
前端·github
Moment16 小时前
使用 Tiptap 编写一个富文本编辑器为什么对很多人来说很难 🤔🤔🤔
前端·javascript·github
小王不爱笑1321 天前
gitignore基本使用+Git分支使用
git
初遇你时动了情1 天前
sourcetree 怎么吧gitee仓库拉取到本地项目中?
gitee
db_cy_20621 天前
Git对服务器配置文件进行版本控制
运维·服务器·git
好好研究1 天前
Git - Git分支管理
git
冬-梦1 天前
iPad Obsidian Git 同步 Gitee 仓库完整指南
git·gitee·ipad·obsidian·efficiency