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
相关推荐
GoodStudyAndDayDayUp8 分钟前
GXW-Git规范
git
m4Rk_39 分钟前
【论文阅读】Agent 记忆机制(151):DUNE——让源事实更新沿依赖图传播到派生记忆
论文阅读·人工智能·学习·开源·github
这里是北京2 小时前
GitHub仓库推荐:Obsidian Skills,让AI把项目笔记组织成可追溯的知识图
笔记·github
weixin_3077791318 小时前
Git中获取一个目录下所有文件的最后修改人的邮箱
开发语言·git·算法
赤生云电竞18 小时前
网吧无盘系统上云:PXE 与云桌面混合部署实践 —— 基于iPXE、iSCSI与NVIDIA vGPU的架构选型
架构·github
爱嘿嘿的小黑18 小时前
用 Google Antigravity 踩遍登录和环境坑后,我开源了个 30 秒只读体检脚本 + Agent Skill
人工智能·python·github
逛逛GitHub19 小时前
7 天 Star 增长超 1000 的新 GitHub 项目,这一波质量很高。
github
CoderYanger19 小时前
Java EE 进阶:16. Spring原理(第一弹)
java·服务器·数据库·后端·spring·java-ee·github
ynchyong1 天前
Git 急救指南:手滑 add / commit 错了,怎么优雅地撤回
git·手滑
徐小夕1 天前
JitKnow 5.0发布:让AI知识库变成可组装的知识中台
前端·vue.js·github