How to add an app to Codemagic from any private or public repository
When you sign up via OAuth, Codemagic already has access to the repositories you have available on your Git provider account. However, you can add apps from public or private as well as from cloud-based or self-hosted Git repositories.
Connecting repository via SSH
Click Add repository on the Applications page.
Enter the Repository URL for cloning the repository. Usually, the URL is in this format:
Upload the SSH private key file. If your key is password-protected, enter the Private key passphrase.
Alternatively, you can click Generate key pair and have Codemagic create an SSH key pair for you, read more about it below.
Click Add application.
You can then continue configuring your project by selecting a starter workflow.
Generating a key pair in Codemagic
On clicking Generate key pair, Codemagic creates a secure 4096 bit SSH key pair. The private key will be used in Codemagic and the public key must be added to your repository settings. Click Copy to clipboard to copy the public key.
- If your repository is hosted on GitHub, GitLab or Bitbucket, add the public key to your repository’s access/deployment keys.
- For self-hosted repositories, request your git server admins to allow access for the provided public key.
After you have added the public key to your repository settings, finish adding the app by clicking Add repository.
Connecting repository via HTTP/HTTPS
- Click Add repository on the Applications page.
- Enter the Repository URL for cloning the repository. You can find the URL from your repository on clicking Clone / Clone or download. Usually, the URL is in this format:
- If your repository is private, then enter your Username and Password. In the case of a public repository, check Public repository.
- Click Add repository.
Your app will be then listed on the Applications page and you can then continue configuring your project by clicking on Configure for building.
Repositories behind firewall
To allow Codemagic access the private repository, the following IP addresses need to be whitelisted:
184.108.40.206- used by our backend for getting basic information about the repository
220.127.116.11/29- used by our build servers to download the code and build it
Modifying repository access settings
When you have moved your repository or need to update the username/password or private key used to access it, you can change the access details in App settings > Repository settings > Repository access settings. Once you have changed the relevant settings, click Update access settings. Codemagic will verify it has access to the repository using the updated details before saving the settings.