Code repository import and migration FAQ

Updated at:

This document explains how to resolve import failures from a self-hosted GitLab instance and migrate a code repository between Alibaba Cloud DevOps organizations.

Network errors during self-hosted GitLab import

Q: If an import from a third-party code repository fails with the message "Cannot connect. Please ensure the code repository is accessible from the public network." What should I do?

A: This error occurs when your self-hosted GitLab instance is configured with an internal network address, making it inaccessible from the public network. As a result, the repository's clone URL is also an internal address.

In the GitLab repository's clone panel, both the Clone with SSH and Clone with HTTP URLs show an internal IP address, such as 172.x.x.x.

If your self-hosted service is not accessible from the public network, expose the public clone URL of your code repository so that Alibaba Cloud DevOps can clone it.

The following example shows how to use frp to proxy the local GitLab web port if you do not have a domain name:

  1. Change the external_url in gitlab.rb to your public network address:

    grep ^external_url /mnt/gitlab/etc/gitlab.rb

    external_url 'http://47.103.xx.x'

  2. Change the host and port parameters:

    $ cat /mnt/gitlab/data/gitlab-rails/etc/gitlab.yml  
    ## GitLab settings  
    gitlab:    ## Web server settings (note: host is the FQDN, do not include http://)    
    host: 47.103.xx.x    # Public network address    
    port: 20113         # The frp mapped port    
    https: false
  3. In the frpc.ini configuration file, map the address:

    [test-web]   
    type = tcp   
    local_ip = 127.0.0.1   
    local_port = 20113   
    remote_port = 20113
  4. When starting the Docker container, use the mapped address:

    docker run -itd --name gitlab  -p 8443:443  -p 20113:80 -p 20112:22  --restart unless-stopped -v /mnt/gitlab/etc:/etc/gitlab -v /mnt/gitlab/log:/var/log/gitlab -v /mnt/gitlab/data:/var/opt/gitlab  beginor/gitlab-ce:11.0.1-ce.0
  5. Log in to GitLab and verify that the Clone with HTTP URL is now the public network address.

Import a repository between organizations

Related question: How do I import a code repository into another Alibaba Cloud DevOps account?

Explanation: Alibaba Cloud DevOps uses organizations to isolate resources. A code repository is an asset that belongs to an organization, not an individual account. You can use the URL import feature to move a code repository from organization A to organization B.

Import procedure

In organization B, on the code repository homepage, click Import Code Repository in the upper-right corner and select URL import.

In the dialog box, enter a Code Repository Name (required) and a Code Repository Path (including the organization prefix and group selection). The source repository URL must use the HTTP or HTTPS protocol. Publicly accessible repositories do not require authentication. If an import times out (10 minutes), a manual push is recommended. Note that you must convert SVN repositories before pushing them.

Enter the source repository URL from organization A. Then, enter the credentials for an Alibaba Cloud DevOps account with clone permissions for the source repository. You can use either the clone account and HTTPS password, or the clone account and a personal access token.

To find your clone account, navigate to Personal Settings > HTTPS Password.

This page displays your Clone Account (your username) and the settings for your HTTPS password. Here, you can view your clone account or reset your password.

In the upper-right corner, click your user avatar and select Personal Settings.