Selecting Source Code Manually

If Debugger wasn't able to select your correct source code automatically, you can manually specify the location and version of your code.

Expand the Alternative source code panel on the Debug page to display your options.

File size limits

If using the Google Cloud Platform Console for debugging, be aware of the following file size limits:

File location File size limit
Cloud Source Repositories 15 MiB
Supported third-party repositories 15 MiB1
Local repositories Unlimited

Note:
1Supported third-party repositories might have file size limits larger than 15 MiB; however, when using the GCP Console for debugging, your files should be 15 MiB or smaller.

Local files

Regardless of where your source code is stored, you can view local source code on the Debug page. Your files are not uploaded to Google's servers; instead, they're loaded and displayed in the browser using HTML5 APIs.

User interface showing local files button.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the Local files section and click Select source.
  3. Browse to the directory containing your source files and click Upload or OK, depending on your platform. Your files are displayed on the Debug page.

Cloud Source Repositories

You can select Cloud Source Repositories from any project to which you have access — it does not have to belong to the same project as the app that you're debugging.

Image showing Cloud Source Repositories button.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the Cloud Source Repositories section and click Select source.
  3. Select the project, repository, and the branch or tagged version.
  4. Click Select source.

GitHub

You can view source code stored in GitHub directly on the Debug page.

GitHub.com

To connect to your GitHub.com repositories, you must grant Stackdriver access to your repositories through OAuth. The token is stored by Google, and can be revoked from GitHub's settings page at any time.

User interface showing GitHub button.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the GitHub section, and click Select source.
  3. Ensure GitHub.com is selected in the Server drop down.

    User interface showing GitHub.com is selected from the dropdown menu.

  4. An Authorization required window appears the first time. Read the information, click the checkbox next to I consent, and click Authorize.

    User interface showing authentication window for Stackdriver for GitHub.com

    You are redirected to GitHub.com's authentication flow.

  5. Follow GitHub's instructions to grant Stackdriver access to your repositories. Once complete, you are returned to the Debug page.

  6. Select a repository, and the branch or tag, and click Select source. Your source code is displayed on the Debug page.

  7. To access public repositories not in the list, type the owner followed by a '/'. The list will be populated with the public repositories of that owner.

    User interface showing how to select a public repository.

Note that your source code is not stored on Google servers.

GitHub Enterprise

To connect to your GitHub Enterprise repositories, you must grant Stackdriver access to your repositories via personal access token. The token is stored by Google, and can be revoked from GitHub's settings page via YOUR-SERVER-ADDRESS/settings/tokens at any time.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the GitHub section, and click Select source.
  3. From the Server drop-down, select a server of your choice or 'Add Server' if it is not there.

    User interface showing a GiHub.com server selected from
the drop down menu.

  4. Provide the hostname to your server. Ensure the host is reachable from your machine.

  5. Provide the personal access token to your server. Ensure the token has the repo scope.

    User interface showing how to add a GitHub server
with hostname and personal access token filled in.

  6. Select the repository and branch or tag as you would with GitHub.com.

Note that your source code is not stored on Google servers.

Bitbucket

You can view source code stored in Bitbucket directly on the Debug page. To connect to your Bitbucket repositories, you must grant Stackdriver access to your repositories through OAuth. The token is stored by Google, and can be revoked from Bitbucket's settings page at any time by selecting OAuth from the left menu.

User interface showing Bitbucket button.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the Bitbucket section, and click Select source.
  3. An Authorization required window appears the first time. Read the information, click the checkbox next to I consent, and click Authorize.

    User interface showing authentication window for Bitbucket.org.

    You are redirected to Bitbucket's authentication flow.

  4. Follow Bitbucket's instructions to grant Stackdriver access to your repositories. Stackdriver requires read access only. Once complete, you're returned to the Debug page.

  5. Select a repository, and the branch or tag, and click Select source. Your source code is displayed on the Debug page.

  6. To access public repositories not in the list, type the owner followed by a '/'. The list will be populated with the public repositories of that owner.

    User interface showing how to select a public repository.

Note that your source code is not stored on Google servers.

GitLab

You can view source code stored in GitLab directly on the Debug page.

GitLab.com

To connect to your GitLab repositories, you must grant Stackdriver access to your repositories through OAuth. The token is stored by Google, and can be revoked from GitLab's setting page at any time.

User interface showing GitLab button.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the GitLab section, and click Select source.
  3. Ensure GitLab.com is selected in the Server drop down.
  4. An Authorization required window appears the first time. Read the information, click the checkbox next to I consent, and click Authorize.

    User interface showing authentication window for GitLab.com.

    You are redirected to GitLab's authentication flow.

  5. Follow GitLab's instructions to grant Stackdriver access to your repositories. Once complete, you're returned to the Debug page.

  6. Select a repository, and the branch or tag, and click Select source. Your source code is displayed on the Debug page.

  7. To access public repositories not in the list, type the owner followed by a '/'. The list will be populated with the public repositories of that owner.

    User interface showing how to select a public repository.

Note that your source code is not stored on Google servers.

GitLab CE/EE

To connect to your GitLab CE/EE repositories, you must grant Stackdriver access to your repositories via personal access token. The token is stored by Google, and can be revoked from GitLab's settings page via YOUR-SERVER-ADDRESS/profile/personal_access_tokens at any time.

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the GitLab section, and click Select source.
  3. From the Server drop-down select a server of your choice or 'Add Server' if it is not there.

    Image showing a GitLab server being added.

  4. Provide the hostname to your server. Ensure the host is reachable from your machine.

  5. Provide the personal access token to your server. Ensure the token has the api scope.

    User interface showing a GitHub server being added with
hostname and personal access token filled in.

  6. Select the repository and branch or tag as you would with GitLab.com.

Note that your source code is not stored on Google servers.

App Engine

If your app is hosted on App Engine standard environment and is written in PHP or Python, this option displays the source code as it was deployed to App Engine, without the need to connect a repository or upload your source.

User interface showing App Engine button.

This option should be selected automatically for supported projects; if it is not selected:

  1. From the source location drop-down menu, click Add source code.
  2. In the Alternative source code pane, find the App Engine section, and click Select source.

If source code downloads are not allowed for your project, you see either a permissions error or an Organization Policy notice. For more information on source code permissions, see Downloading Source Code.

Bu sayfayı yararlı buldunuz mu? Lütfen görüşünüzü bildirin:

Şunun hakkında geri bildirim gönderin...

Stackdriver Debugger Documentation