Home > Development Tools > git > body text

How to synchronize Github with Gitee?

Guanhui
Release: 2020-06-05 15:32:27
Original
6699 people have browsed it

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
Copy after login

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 after login

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
Copy after login

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

Submit to github

git push github master
Copy after login

Submit to Code Cloud

git push gitee master
Copy after login

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!

Related labels:
git
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!