Migrate multiple local Git repositories to Codeup in a single operation using Codeup-CLI. The tool imports all Git data, including source code, branches, commits, and tags.
Prerequisites
Before you begin, make sure that you have:
-
Codeup-CLI installed and running correctly. For more information, see Install the migration tool.
-
A personal access token with read and write permissions for repositories and groups. For more information, see Obtain a personal access token.
-
Either HTTP credentials (username and password) or an SSH key configured in Codeup.
Migration limitations
-
Test first. Run a test migration with a non-production repository before migrating production repositories.
-
Do not write during migration. Avoid making changes or write operations to local repositories while migration is in progress.
-
No re-sync after migration. Rerunning the migration does not sync new changes from a local repository to Codeup. The tool only performs the initial import.
Step 1: Create the configuration file
Create a config.yaml file that defines the migration source, target, and scope. Specify credentials for either HTTP or SSH, not both.
Source parameters
|
Parameter |
Required |
Description |
|
|
Yes |
Set to |
Target parameters
|
Parameter |
Required |
Description |
|
|
Yes |
The domain name of Apsara Devops. Example: |
|
|
Yes |
A personal access token with read and write permissions for repositories and groups. |
|
|
HTTP only |
The username for HTTP cloning in Codeup. |
|
|
HTTP only |
The password for HTTP cloning in Codeup. |
|
|
SSH only |
The full path to the local private key that corresponds to the SSH key configured in Codeup. Example: |
Scope parameter
| Parameter | Required | Description |
|---|---|---|
projectListPath |
Yes | The file path for the repository migration scope defined in Step 2. |
Example configuration (SSH)
# Required. The version number, v2, which identifies the current configuration version.
version: "v2"
import:
source:
platform: "local"
target:
host: "https://***.devops.alibabacloudcs.com"
# A personal access token with read and write permissions for repositories and groups.
accessKey: "pt-******03GFpdmIedUgug****_******-3734-484a-9b4b-248569f78c9d"
localSSHKeyPath: "/Users/****/.ssh/id_rsa"
# projectListPath specifies the file path for the repository migration scope defined in Step 2.
projectListPath: "projects.csv"
Step 2: Define the migration scope
Generate a projects.csv file that lists the repositories to migrate. The file path must match the projectListPath value in config.yaml.
Run the following command:
./codeup-cli import --gen project
This creates a projects.csv file in the current directory. Each line defines one repository in the following format:
[Absolute path of local repository],[Relative path of Codeup repository],[Visibility of Codeup repository]
Example:
#Absolute path of local repository,Relative path of Codeup repository (supports nested subdirectories),Visibility of Codeup repository
/Users/my/Downloads/groupname/demo,groupname/demo,10
This entry migrates the local repository at /Users/my/Downloads/groupname/demo to groupname/demo in Codeup with Internal visibility.
Repository visibility
| Value | Visibility |
|---|---|
0 |
Private |
10 |
Internal |
Any value other than 0 is automatically set to 10 (Internal).
Step 3: Run the migration
Place config.yaml, projects.csv, and the repository folders in your working directory. Then run:
./codeup-cli import --run true --config=./config.yaml
The tool displays migration details during the process. Error messages appear if issues occur.
Verify the migration result
After the migration completes, open your Codeup organization to view the migrated repositories and confirm the migration was successful.
Troubleshooting
A repository migration fails
If Git data migration for a repository fails, its status is marked as Failed. Review the error messages displayed during the migration to identify the cause.
Retry failed migrations
Run the import command again. The tool skips successfully imported repositories and retries only the failed ones.
./codeup-cli import --run true --config=./config.yaml
Contact support
If you encounter problems during the migration, join DingTalk group 32027065 for technical support.