Learn how to use Codeup-CLI to migrate code repositories from third-party platforms such as GitHub, Gitee, and Coding to Codeup.
Before you start
Install Codeup-CLI. It migrates Git data from third-party code repositories, including source code, branches, commits, and tags.
Try Codeup-CLI with a test code repository before formal migration.
During migration, do not make any changes to the code repository, as modifications cannot be synchronized to Codeup even if you migrate the repository again.
1. Configure migration information
Configure migration sources and targets. Fill in either HTTP or SSH clone information.
source - Source platform configuration item | Required | Parameter description |
platform | Required | Enter "common". |
username | Required if using HTTP clone | Username for HTTP clone of the third-party platform. |
password | Required if using HTTP clone | Password for HTTP clone of the third-party platform. Note that if the source platform is GitHub, fill in password with Token. Github no longer supports logon password for authentication. |
localSSHKeyPath | Required if using SSH clone | The full path to the local private key that corresponds to the SSH key configured on the third-party platform, such as /Users/my/.ssh/id_rsa. |
target - Target platform parameter configuration | Required | Parameter description |
host | Required | The domain of Alibaba Cloud DevOps, such as https://***.devops.alibabacloudcs.com. |
accessKey | Required | A valid personal access token with read and write permissions for code repositories and code groups. See Obtain a personal access token. |
username | Required for HTTP clone | Username for HTTP clone of Codeup. |
password | Required for HTTP clone | Password for HTTP clone of Codeup. |
localSSHKeyPath | Required for SSH clone | The full path to the local private key that corresponds to the SSH key configured on Codeup, such as /Users/my/.ssh/id_rsa. |
Below is an example of simplified config.yaml configuration file using SSH clone:
# Required version number v2, used to identify the current configuration version
version: "v2"
import:
source:
platform: "common"
localSSHKeyPath: "/Users/****/.ssh/id_rsa"
target:
# Alibaba Cloud DevOps endpoint
host: "https://***.devops.alibabacloudcs.com"
# Personal access token, requires read and write permissions for code repositories and code groups
accessKey: "pt-******03GFpdmIedUgug****_******-3734-484a-9b4b-248569f78c9d"
localSSHKeyPath: "/Users/****/.ssh/id_rsa"
# projectListPath specifies the path to the migration scope file in step 2
projectListPath: "/Users/****/workspace/projects.csv"
# workDir specifies the working directory path for migration, which will be automatically cleaned up after migration
workDir: "/Users/****/workspace" 2. Define migration scope
Generate a configuration file using the following command, and list the repositories to be migrated in the file. The file path is the projectListPath specified in step 1.
./codeup-cli import --gen project This command generates a projects.csv configuration file in the current directory. Each line of it includes: [asolute path of the third-party repository], [relative path of the Codeup repository], and [visibility of the Codeup repository]. Below is an example of the configuration file:
#GitHub repository absolute path,Codeup repository relative path (supports nested multi-level directories),Codeup repository visibility
https://github.com/namesapce/demo.git,namesapce/demo,10
#Gitee repository absolute path,Codeup repository relative path,Codeup repository visibility
https://gitee.com/namesapce/demo.git,namesapce/demo,10
#Coding repository absolute path,Codeup repository relative path,Codeup repository visibility
https://e.coding.net/namesapce/demo.git,namesapce/demo,10
For repository visibility, 0 indicates "private", and 10 indicates "organization-wide public". Any non-0 number entered will be automatically converted to 10.
When using this file, please delete the example data and replace it with your addresses.
3. Execute migration
Confirm the migration information file, the migration scope file, and the folder for storing repositories are ready in your current working directory, and migrate using the following command:
./codeup-cli import --run true --config=./config.yaml
// Pay attention to the messages generated by the command if any exceptions occurred.If the migration fails, the repository status will be marked as migration failed.
If the migration is executed repeatedly, code repositories that have been successfully imported will be noted and skipped; those that were not successfully imported will be retried for import.
GitHub repositories may experience clone timeouts depending on your network. Check your network connectivity and try migration again.
When the migration completes, go to Codeup to check the migrated repository.
If you encounter any problems during migration, join the DingTalk group 32027065 for technical support.