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.

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. This option is supported only in Google Chrome.

Local files source card

  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.

Google Cloud Source Repository

You can select a Cloud Source Repository 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.

Cloud Source Repository source card

  1. From the source location drop-down menu, click Add source code...
  2. In the Alternative source code pane, find the Google Cloud Source Repository 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 Google 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.

GitHub source card

  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.

    Selecting the GitHub.com server

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

    Authorizing Google Stackdriver for GitHub.com

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

  5. Follow GitHub's instructions to grant Google 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.

    Selecting 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 Google 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.

    Add a GitHub server

  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.

    Add GitHub server information

  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 Google 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.

Bitbucket source card

  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.

    Alternative source code pane

    You are redirected to Bitbucket's authentication flow.

  4. Follow Bitbucket's instructions to grant Google Stackdriver access to your repositories. Google 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.

    Selecting 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 Google 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.

GitLab source card

  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.

    Alternative source code pane

    You are redirected to GitLab's authentication flow.

  5. Follow GitLab's instructions to grant Google 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.

    Selecting 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 Google 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.

    Add a GitLab server

  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.

    Add GitLab server information

  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.

App Engine source card

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.

Upload source code version

Uploading source code version makes it easy to use the source code for debugging, over multiple sessions, even when a source change is not submitted to the source control repository.

Upload source card

  1. From the source location drop-down menu, click Add source code...
  2. In the Alternative source code pane, in the section labeled Upload a source code capture to Google servers, copy the gcloud command and paste it into your terminal app.
  3. Replace LOCAL_PATH with the location of your source code directory.
  4. Execute the gcloud command.
  5. In the Alternative source code pane, click Select source in the Upload a source code capture... section.
Was this page helpful? Let us know how we did:

Send feedback about...

Stackdriver Debugger Documentation