How to sync GitLab repository to GitHub and Gitee?

Table of contents

Preface

1. Synchronize GetLab warehouse to GitHub

1.1-Create GitHub repository

1.2-Obtain GitHub Token

1.3-Configuring synchronization on GitLab

2. Synchronize GitLab warehouse to Gitee

2.1-Create Gitee repository

2.2-Obtain Gitee Token

2.3- Configuring synchronization on GitLab

3. Two-way synchronization between Gitee and GitHub

3.1-Create GitHub repository

3.2-Obtain GitHub Token

3.3- Configuring synchronization on Gitee


Author: Xigua Programmer

Homepage Portal:Xigua Programmer_ASP.NET Core,ASP.NET,Database-CSDN Blog

Preface

In the [Kimi.RocketMQ.NET] open source project I wrote before, I put the code on the GitLab server I built. Then every time I submit the code, I hope to synchronize it to GitHub and Gitee in real time, so this article will be recorded Let’s talk about how GitLab synchronizes to GitHub, and how GitLab synchronizes to Gitee. Of course, there are also related operations such as how GitHub synchronizes to Gitee, and how Gitee synchronizes to GitHub (two-way synchronization).

1. Synchronize GetLab warehouse to GitHub

1.1-Create GitHub repository

(1) Log in first, and then create an empty warehouse on GitHub to be used as the synchronized warehouse.

GitHub:GitHub: Let’s build from here · GitHub

(2) Fill in the name and description of the warehouse, then set the access rights to public or private according to your needs, and finally click [Create repository] to create an empty warehouse.

1.2-Obtain GitHub Token

(1) Then you need to generate a Token on GitHub. You need to log in first, then click [Avatar] in the upper right corner ->[Settings].

(2) Click [Developer settings], and click [Personal access tokens] ->[Tokens (classic)] ->[Generate new token] in the newly opened page.

(3) Then enter [Token name] the name of the Token, [Repository access] I chose All repositories (applicable to all current and future repositories owned by the resource owner. Also includes public repositories (read-only)).

(4) Then click [Generate token] to generate Token.

(5) Finally, click to copy the Token (the Token will be saved by itself).

1.3-Configuring synchronization on GitLab

(1) First find the [username] on the GitHub and Gitee platforms, which will be used later.

GitHub:

Gitee:

(2) Then create a warehouse in GitLab, and pull/submit/merge operations are performed on GitLab. [Xigua Programmer] The warehouse is ready [Kimi.RocketMQ.NET], so I won’t go into details here about how to create a warehouse in GitLab. Then click on the project to be synchronized, click [Settings] -> [Warehouse] -> [Mirror Warehouse], and click [Expand].

(3) Finally fill in the [Git warehouse address] and [Password], ask to see the picture below, and then click [Mirror Warehouse].

2. Synchronize GitLab warehouse to Gitee

2.1-Create Gitee repository

(1) Log in first, then create a warehouse and obtain the warehouse link.

Gitee:Gitee - Enterprise-level DevOps R&D performance platform

(2) Enter [Warehouse Name] [Path]. The default status is [Private]. If you need to create a public warehouse, please change it to public through "Warehouse Settings" after creating the warehouse.

(3) Copy the warehouse address.

2.2-Obtain Gitee Token

(1) Then you need to generate a Token in Gitee. You need to log in first, and then click [Avatar] in the upper right corner ->[Settings] ->[Private Token] ->[Generate New Token].

(2) Then fill in the relevant information, you can check everything and click [Submit].

(3) Then click [Copy] to save the key. The platform will no longer display the private token, please keep it properly.

It is also possible to edit, re- and obtain keys:

2.3- Configuring synchronization on GitLab

(1) First find the [username] on the GitHub and Gitee platforms, which will be used later.

GitHub:

Gitee:

(2) Then create a warehouse in GitLab, and pull/submit/merge operations are performed on GitLab. [Xigua Programmer] The warehouse is ready [Kimi.RocketMQ.NET], so I won’t go into details here about how to create a warehouse in GitLab. Then click on the project to be synchronized, click [Settings] -> [Warehouse] -> [Mirror Warehouse], and click [Expand].

(3) Finally fill in the [Git warehouse address] and [Password], ask to see the picture below, and then click [Mirror Warehouse].

3. Two-way synchronization between Gitee and GitHub

3.1-Create GitHub repository

(1) First log in to GitHub, and then create an empty warehouse to be used as the synchronized warehouse.

(2) Fill in the name and description of the warehouse, then set the access rights to public or private according to your needs, and finally click [Create repository] to create an empty warehouse.

3.2-Obtain GitHub Token

(1) Then you need to generate a Token on GitHub. You need to log in first, then click [Avatar] in the upper right corner ->[Settings].

(2) Click [Developer settings], and click [Personal access tokens] ->[Tokens (classic)] ->[Generate new token] in the newly opened page.

(3) Then enter [Token name] the name of the Token, [Repository access] I chose All repositories (applicable to all current and future repositories owned by the resource owner. Also includes public repositories (read-only)).

(4) Then click [Generate token] to generate Token.

(5) Finally, click to copy the Token (the Token will be saved by itself).

3.3- Configuring synchronization on Gitee

(1) Click on the warehouse project to be synchronized, and then click [Manage] -> [Warehouse Image Management], and then you need to use your GitHub account to authorize you to log in. You can choose push/pull (two-way synchronization) for the mirroring direction, [Xigua Programmer] Select push here, which means pushing from Gitee to GitHub.

(2) Synchronization will be performed automatically, or you can click [Update] manually.

Note: Warehouse mirroring supports automatic synchronization of Gitee warehouse data between Gitee and other code hosting platforms, including code submissions, branches, and tags.

  • Currently only supports automatic synchronizationGitHub.com warehouse, and the account needs to be bound to a mobile phone Number and authorize the corresponding GitHub account .
  • Synchronous Git LFS is not supported yet.
  • The maximum timeout for a single synchronization is 30 minutes. It is not recommended to use mirror synchronization for large warehouses. More instructions >>
  • This feature is currently open for a limited time until December 31, 2023. We will update the relevant product strategies before the end of the limited opening period.

Copyright statement: This article is an original article, and the copyright belongs to [Xigua Programmer]. Please indicate the source when reprinting. If you have any questions, please send a private message.

Original link:How to synchronize GitLab warehouse to GitHub and Gitee?_Xigua Programmer's Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/2301_79251107/article/details/132804950