同步gitee和github

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/aeoliancrazy/article/details/86541307

同步gitee和github

参考帖
https://segmentfault.com/q/1010000015718860
https://www.cnblogs.com/tinywan/p/8241077.html

我的做法是

第一步,在创建码云(gitee)的项目的时候,选择导入已有仓库
在这里插入图片描述
第二步,修改.git文件夹里面的config文件的配置,建议直接使用VIM编辑
vim的编辑器的使用,简单的自己查一下,很简单
i 插入
先按ESC 再shift+zz 保存并退出

在这里插入图片描述

$ cat config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
[remote "origin"]
        url = https://github.com/your github address.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[remote "second"]
        url = https://gitee.com/your gitee address.git
        fetch = +refs/heads/*:refs/remotes/second/*

配置完成

第三步,git push提交即可
注意
根据第二步的配置
目前git无法识别 只有git push的命令
如果要提交到github
使用

git push origin master

如果要提交到gitee
使用

git push second master

猜你喜欢

转载自blog.csdn.net/aeoliancrazy/article/details/86541307