git同时提交到2个仓库gitee github
2022/4/19 23:14:01
本文主要是介绍git同时提交到2个仓库gitee github,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
本文由 简悦 SimpRead 转码, 原文地址 www.csdn.net
csdn已为您找到关于git 同时提交多个仓库相关内容,包含git 同时提交多个仓库相关文档代码介绍、相关教程视频课程,以及相关git 同时提交多个仓库问答内容。为您解决当下相关问题,如果想了解更详细git 同时提交多个仓库内容,请点击详情链接进行了解,或者注册账号与客服人员联系给您提供相关内容的帮助,以下是为您准备的相关内容。
1.进入项目根目录
2.点击查看,显示隐藏文件夹
出现git文件夹
3.进入.git文件夹
4.
4.编辑config
原文件
修改后
代码如下
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [submodule] active = . [remote "origin"] url = https://gitee.com/stylesmile/snow.git fetch = +refs/heads/*:refs/remotes/origin/* url = https://github.com/stylesmile/snow.git [branch "master"] remote = origin merge = refs/heads/master [remote "github"] url = https://github.com/stylesmile/snow.git fetch = +refs/heads/*:refs/remotes/gitee/* tagopt = --no-tags
再次push ,就会同时提交到2个仓库
有时候一个项目,希望既提交到 oschina 又提交到公司内网的 gitlab,或者是 github 什么的。
使用 git remote -v 查看当前 git 的远程仓库。
添加一个远程仓库
git remote add <name> <url-of-remote> ###<name>自己起个名字,默认是oringn,那么添加的第二个我们可以叫oschinaxxx,这样比较方便记忆是哪个源,<url of remote>是第二个git仓库的url链接。 此时我们还不能就立即使用
git push oschinaxxx master这样直接提交了,git会提示让我们先pull, 此时
git pull oschinaxxx master 还会报错,非关联的仓库不能拉下来。 使用如下命令,添加--allow-unrelated-histories参数
git pull oschinaxxx master --allow-unrelated-histories解决之。 之后就可以愉快的给远程仓库push了 git push <name of remote repository> <name of branch>,就可以push到相应的仓库了。也可以在pycahrm上直接完成这个。 可以做成一个bat批处理脚本,来运行push
git diff --name-only HEAD~1 HEAD git pull ocmtdcs master git pull origin master git push ocmtdcs master git push origin master pause
这篇关于git同时提交到2个仓库gitee github的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-13TiDB + ES:转转业财系统亿级数据存储优化实践
- 2024-05-09“2024鸿蒙零基础快速实战-仿抖音App开发(ArkTS版)”实战课程已上线
- 2024-05-09聊聊如何通过arthas-tunnel-server来远程管理所有需要arthas监控的应用
- 2024-05-09log4j2这么配就对了
- 2024-05-09nginx修改Content-Type
- 2024-05-09Redis多数据源,看这篇就够了
- 2024-05-09Google Chrome驱动程序 124.0.6367.62(正式版本)去哪下载?
- 2024-05-09有没有大佬知道这种数据应该怎么抓取呀?
- 2024-05-09这种运行结果里的10.100000001,怎么能最快改成10.1?
- 2024-05-09企业src漏洞挖掘-有意思的命令执行