Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to synchronize two git repositories to gitee and github at the same time

2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

The main content of this article is to explain "how to synchronize two git repositories to gitee and github at the same time", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor learn how to synchronize two git repositories to gitee and github at the same time.

Sometimes we may transfer git code to two different git code repositories to keep the warehouse code safe. Let's show you how to do this:

First, create two warehouses.

# assume that the addresses of the two warehouses created are: https://gitee.com/cigoos/mycode.githttps://github.com/cigoos/mycode.git

Check out the code from one of the warehouses first

Git clone https://gitee.com/cigoos/mycode.git

Delete warehouse origin

Git remote rm origin

Associate two remote warehouses

# Associate giteegit remote add gitee https://gitee.com/cigoos/mycode.gitgit push gitee master# Associate githubgit remote add github https://github.com/cigoos/mycode.gitgit push github master

# Note: if you encounter the following problems, To https://github.com/CigoOS/cigoadmin_tp5.git! [rejected] master-> master (fetch first) error: failed to push some refs to 'https://github.com/cigoos/mycode.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g.,' git pull...') Before pushing again.hint: See the 'Note about fast-forwards' in' git push-- help' for details.# needs to execute git pull github master-- allow-unrelated-histories at this time

Delete Branch

Git push origin-- delete devgit branch-D dev

Check out local branch

# create a local branch giteegit checkout-b gitee/master gitee based on gitee/master

Merge branches

Git merge-squash dev-allow-unrelated-histories

At this point, I believe you have a deeper understanding of "how the project synchronizes two git repositories to gitee and github at the same time". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report