How to Manage an App's Source Repository

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.


You can change your app’s repository by updating the app’s spec. You cannot change the app’s repository using the control panel, at this time. To change the app’s repository, the new repository must be discoverable and not in use by another app on App Platform.

To access the app spec from the DigitalOcean Control Panel, click on your app, and then click on the Settings tab. From there, scroll down to the App Spec section and then click Edit.

Alternatively, you can download the app’s spec and then edit it using your preferred text editor. To do this, click the Download button in the App Spec editor. After updating the app spec file, upload the updated file using the Upload File button.

If you use a Git provider as your hosting service, you can change the repository by changing the repo value nested within the github or gitlab block.

github: 
  branch: main
  deploy_on_push: true
  repo: your-new-repository

If you wanted to change the hosting service, then you would change the hosting service key specified in the app spec file. For example, if you changed the hosting service from GitHub to GitLab in the code snippet above, then you would change the code like this:

gitlab: 
  branch: main
  deploy_on_push: true
  repo: your-new-repository

If you use an image registry such as DigitalOcean Container Registry (DOCR) (DOCR) or Docker Hub (DOCKER_HUB) as your hosting service, you can change the repository by changing the repository value nested within the image block.

image:
  registry_type: DOCKER_HUB
  registry: nginxdemos
  repository: your-new-repository

If you want to swap image registries, update the registry_type value in the image block. For example, if you changed the hosting service for the above code snippet from Docker Hub to DOCR, then the code snippet would look like this:

image:
  registry_type: DOCR
  registry: 
  repository: your-new-repository
Note
For DOCR, the registry value can either be set or empty, while Docker Hub requires a registry value. For DOCR, leaving the registry value empty defaults the value to your team’s DOCR instance. Since your team can only have one DOCR instance, we recommend leaving the registry value empty.

To switch from an image registry to a Git provider, you will need to ensure that your account on your image registry is both authorized against your Git provider and registry as Git repositories both require an OAuth flow against their Git provider. Authorization against a Git provider such as GitHub and GitLab is typically done when you initially create an app on App Platform. Authorization is not required for DOCR or Docker Hub since DOCR is associated with your DO account, and Docker Hub is public with no authorization required.