Adding repositories
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.
- Note that webhooks for automatic build triggering need to be created manually.
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:
git@example.com:username/repo.git
.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:
https://example.com/path/to/repository.git
. - 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:
34.74.234.56
- used by our backend for getting basic information about the repository199.7.162.128/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.