Home >Development Tools >git >How to synchronize Github with Gitee?

How to synchronize Github with Gitee?

Guanhui
GuanhuiOriginal
2020-06-05 15:32:276776browse

How to synchronize Github with Gitee?

How to synchronize Github with Gitee?

First associate the remote repositories of Github and Gitee;

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

Then open the configuration file in the ".git" folder; then modify the remote to change two, one Github repository and the other Gitee library;

[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

Copy the content of the above file [remote "origin"] and modify the origin name. The content is as follows:

[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

The final code can be submitted to Github and Gitee respectively.

Submit to github

git push github master

Submit to Code Cloud

git push gitee master

Recommended tutorial: "Git Tutorial"

The above is the detailed content of How to synchronize Github with Gitee?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is Gitee Chinese?Next article:Is Gitee Chinese?