GitHub仓库快速导入Gitee及同步更新

Diane ·
更新时间:2024-11-13
· 905 次阅读

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



gitee github 更新

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章