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
相关推荐
西西偷西瓜4 小时前
Soybean Admin移除git-hooks永久关闭git校验
git·vue
Archie_IT5 小时前
修图自由!自建IOPaint服务器,手机平板随时随地远程调用在线P图
运维·服务器·前端·git·深度学习·npm·conda
油泼辣子多加5 小时前
2025年04月11日Github流行趋势
github
Qredsun7 小时前
获取git分支间差异文件列表
git
黑眼圈的小熊猫7 小时前
Git开发
大数据·git·elasticsearch
Gladiator5757 小时前
博客记录-day140-场景题
github
uhakadotcom13 小时前
模型上下文协议(MCP):简化AI与外部工具的集成
后端·面试·github
小镇敲码人13 小时前
【深入浅出 Git】:从入门到精通
git
uhakadotcom14 小时前
JAX 框架:高性能数值计算的新时代
算法·面试·github
uhakadotcom14 小时前
构建实时API智能代理:快速构建多代理语音应用
算法·面试·github