Home > Development Tools > git > body text

How to convert gitee repository to open source

PHPz
Release: 2023-03-31 11:02:31
Original
1068 people have browsed it

In recent years, with the popularity of open source software and the development of the open source community, more and more developers have begun to open source their projects. At the same time, in order to better manage project code and expand the influence of the project, many developers have also begun to use code hosting platforms, among which platforms represented by GitHub have become popular.

However, in some scenarios, we may need to host the code on a domestic code hosting platform, such as gitee. When we decide to host the code on gitee, the first thing we need to consider is how to migrate the code repository from GitHub to gitee.

Generally speaking, there are two ways to migrate code: one is to directly export the GitHub code, then create a new warehouse on gitee and import the code; the other is to use open source tools to directly migrate the GitHub warehouse Transfer to gitee. The specific operation steps of these two methods are introduced below.

Method 1: Export the code from GitHub and upload it to gitee
The first step is to open the GitHub warehouse page, click the "Clone or download" button above the warehouse, and select the "Download ZIP" option to download the code to local.

The second step is to open the gitee official website, select "New Warehouse" on the personal center page, fill in the warehouse name, description, code agreement and other information, and then click "Submit".

The third step, on the new warehouse page, click the "Upload Code" button, select the code ZIP file you just downloaded and click "Upload" and wait for the upload to complete.

Method 2: Use open source tools to complete GitHub warehouse transfer
Another way to transfer GitHub warehouse is to use the gitlab-mirrors tool. This tool is specially developed for migrating GitHub repositories to other code hosting platforms. It can easily transfer the code on GitHub to gitee.

The specific steps are as follows:
In the first step, click the "Settings" button in the upper right corner of the warehouse page on GitHub, open the "Options" page, slide to the bottom to find the "Danger Zone" area, and click " Export repository" button to package and download the code locally.

The second step is to open the gitlab-mirrors GitHub homepage, download the project locally, and then execute the "bundle install" command to install the necessary library files.

The third step, the required configuration file .env file needs to be created in the project root directory, and then set the gitee token:

GITLAB_API_ENDPOINT=https://gitee.com/api /v5/
GITLAB_API_PRIVATE_TOKEN=YOUR_GITEE_TOKEN

(Note: YOUR_GITEE_TOKEN here needs to be replaced with your own gitee personal API private token)

The fourth step is to execute the following command in the terminal :

bundle exec ruby ​​gitee.rb USERNAME SOURCE_REPO_URL TARGET_NAMESPACE TARGET_REPO_NAME

Among them:

  • USERNAME: gitee account name
  • SOURCE_REPO_URL: GitHub warehouse HTTPS URL
  • TARGET_NAMESPACE:gitee account name
  • TARGET_REPO_NAME:gitee warehouse name

After the execution is completed, you can find the transferred warehouse in gitee.

Summary
In this article, we introduced two methods to transfer GitHub repository to gitee, namely exporting code from GitHub and uploading to gitee, and using gitlab-mirrors tool to complete the migration. No matter which method we choose, we need to pay attention to retaining the ownership and license of the good code and comply with the relevant regulations of open source software. By hosting open source projects on gitee, we can manage and share our projects more conveniently, and we can also join the broader open source community and make our own contributions to the open source cause.

The above is the detailed content of How to convert gitee repository to open source. For more information, please follow other related articles on the PHP Chinese website!

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!