Github和Gitee进行同步的方法

发布时间:2020-12-15 11:09:05 作者:小新
来源:亿速云 阅读:952

这篇文章将为大家详细讲解有关Github和Gitee进行同步的方法,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

Github 如何和 Gitee 进行同步?

首先关联Github和Gitee的远程仓库;

git remote add github git@github.com:code/demo.git
git remote add gitee git@gitee.com:code/demo.git

然后打开“.git”文件夹内的配置文件;接着修改remote改两个,一个Github库另一个Gitee库;

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git@github.com:chloneda/demo.git
    fetch = +refs/heads/*:refs/remotes/github/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

将上述文件内容[remote "origin"]内容复制,修改origin名称,内容如下:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "github"]
    url = git@github.com:chloneda/demo.git
    fetch = +refs/heads/*:refs/remotes/github/*
[remote "gitee"]
    url = git@gitee.com:chloneda/demo.git
    fetch = +refs/heads/*:refs/remotes/gitee/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

最后代码分别提交到Github和Gitee即可。

提交到github

git push github master

提交到码云

git push gitee master

关于Github和Gitee进行同步的方法就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

推荐阅读:
  1. 使用Gitee和Hexo创建自己的博客
  2. 怎样进行github的使用

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

github gitee te

上一篇:将sublime text3设为中文的方法

下一篇:yii2关闭调试的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》