Text of docs.cloud.google.com › run › docs › continuous-deployment as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Continuously deploy from a repository | Cloud Run | Google Cloud Documentation

Skip to main content Continuously deploy from a repository Stay organized with collections Save and categorize content based on your preferences. If you have source code or functions in a Git repository and want to automate builds and set up continuous deployments from a repository, you can use either Cloud Build or Developer Connect in the Cloud Run console. When you set this up, Cloud Run uses a Cloud Build trigger , to automatically build and deploy your code whenever new commits are pushed to a given branch of a Git repository.

The source repository information is displayed in the Google Cloud console for your service after you deploy to Cloud Run. In the Cloud Run console: If you select Cloud Build, you can set up continuous deployments from GitHub. For an example, see the quickstart for creating a template repository and deploying continuously from git . If you select Developer Connect, you can set up continuous deployments from GitHub, GitLab, and Bitbucket repositories.

Alternatively, you can use Cloud Deploy to set up a continuous-delivery pipeline to deploy Cloud Run services to multiple environments. Before you begin You either have a git repository with a Dockerfile or your codebase is written in one of the languages supported by Google Cloud's buildpacks . Enable the Cloud Build API, if it is not already enabled. Roles required to enable APIs To enable APIs, you need the serviceusage.services.enable permission.

If you created the project, then you likely already have this permission through the Owner role ( roles/owner ). Otherwise, you can get this permission through the Service Usage Admin role ( roles/serviceusage.serviceUsageAdmin ). Learn how to grant roles . Enable the API If you select the Developer Connect option, enable the Developer Connect API: Enable the API Required roles To get the permissions that you need to deploy Cloud Run services from Git using Cloud Build or Developer Connect, ask your administrator to grant you the following IAM roles on your project: Artifact Registry Administrator ( roles/artifactregistry.admin ) Cloud Build Editor ( roles/cloudbuild.builds.editor ) Cloud Run Developer ( roles/run.developer ) Service Account User ( roles/iam.serviceAccountUser ) Service Usage Admin ( roles/serviceusage.serviceUsageAdmin ) The service account running the build must have the following roles: Cloud Build Service Account ( roles/cloudbuild.builds.builder ) Cloud Run Admin ( roles/run.admin ) Service Account User ( roles/iam.serviceAccountUser ) If you select the Developer Connect option: Developer Connect Read Token Accessor ( roles/developerconnect.readTokenAccessor ) If you are connecting to GitLab or Bitbucket repositories: Secret Manager Secret Accessor ( roles/secretmanager.secretAccessor ) For a list of IAM roles and permissions that are associated with Cloud Run, see Cloud Run IAM roles and Cloud Run IAM permissions .

If your Cloud Run service interfaces with Google Cloud APIs, such as Cloud Client Libraries, see the service identity configuration guide . For more information about granting roles, see deployment permissions and manage access . Set up continuous deployment from the Cloud Run console The setup procedure varies slightly depending on whether you are setting up continuous deployment on a new service or on an existing service.

Click the appropriate tab to learn more. New service In the Google Cloud console, go to the Cloud Run page: Go to Cloud Run Click Connect repository to display the Create service form. Select Cloud Build or Developer Connect . If you selected Cloud Build , see Set up with Cloud Build . If you selected Developer Connect , see Set up with Developer Connect . Existing service In the Google Cloud console, go to the Cloud Run page: Go to Cloud Run Locate the service in the services list, and click it.

Click the Source tab. Click Connect to repo and follow the instructions in Set up with Cloud Build . Set up with Cloud Build In the Set up with Cloud Build pane: Select a repository from the list. Note that it takes a few moments to load the list of repositories. Follow the prompt and click Next . GitHub is the default repository provider. If you are not yet authenticated, click Authenticate and follow the instructions.

Connecting a repository is done using the Cloud Build GitHub app. If you see an error such as The redirect_uri is not associated with this application , see Troubleshoot GitHub connection . If you can't find your repository, click the Manage connected repositories link. Follow the instructions to grant your repository access to Cloud Build. In the Build Configuration step, fill in the options: Branch Indicates what source should be used when running the trigger.

You can put the regex here. Matched branches are automatically verified: you can see them below the input. Note that if exactly one branch is matched, the trigger will be automatically executed after the creation. Build Type Dockerfile : If your repository should be built using Docker and it contains a Dockerfile, select this option. In Source location , specify the location and name of the Dockerfile. This directory will be used as the Docker build context.

All paths should be relative to the current directory. Go, Node.js, Python, Java, .NET Core, Ruby or PHP via Google Cloud's buildpacks : If your repository should be built using buildpacks, select this option. In the Build context directory , specify the directory. In Entrypoint (optional), provide the command to start the server. For example, gunicorn -p :8080 main:app for Python, and java -jar target/myjar.jar for Java.

Leave this field blank to use default behavior . In Function target (for function deployments only), enter the function to be invoked. Otherwise, leave this field blank. Click Save . The page reloads and brings you back to the Create service form. Verify the selected settings in the Source repository section. Fill out the rest of form under Configure . Click Create . You are redirected to the Service Details page, where you can track the progress of your Building and deploying from repository setup.

After all steps are completed, you can: Click Edit repo settings in the Cloud Run console to edit the Cloud Build trigger in the Cloud Build console. View the Build History by clicking the logs link in the Building and deploying from repository step. View Source details in the Revision Details section . Troubleshoot GitHub connection If you receive the error The redirect_uri is not associated with this application. The application might be misconfigured or could be trying to redirect you to a website you weren't expecting when authenticating with GitHub, GitHub rejected the redirection URL provided during the OAuth handshake.

To resolve this issue, complete the following troubleshooting steps: Verify or reset the repository connection in Cloud Build: In the Google Cloud console, go to the Repositories page: Go to Repositories Locate the connection to your GitHub account or organization. If the repository is connected or in an error state, disconnect the repository or the entire GitHub connection. Return to the Cloud Run console and re-initiate the continuous deployment setup to refresh the OAuth authorization.

Check your Cloud Build GitHub App permissions in GitHub: In GitHub, go to your account or organization settings. In the left navigation, click Applications , and then select the Installed GitHub Apps tab. Locate the Google Cloud Build app and click Configure . Under Repository access , verify that the target repository is selected. If permissions appear correct but authentication fails, revoke access for the app and re-grant access during the Cloud Run setup flow.

Test the connection in a private browser window: Open a new incognito or private browser window. Sign in to the Google Cloud console and your GitHub account. Retry the continuous deployment connection flow to rule out interference from cached cookies, browser extensions, or mul

The rest of this page is on the live site.