Using Cloud Source Repositories

Through Android Studio, you can add new projects to Cloud Source Repositories, and check out existing projects. Currently only Git is supported.

Uploading source code

Before uploading your source to Cloud Source Repositories, you need to create a Cloud project for it through the Google Cloud Platform Console.

You also need to make sure you have a 'default' repository in your project. Go to Cloud Source Repositories, and look for a repository named 'default'. If you don't see one, create one by clicking Create Repository and naming the repository 'default'.

To upload your source to Cloud Source Repositories from Android Studio:

  1. In Android Studio, open the project you want to add to Cloud Source Repositories.
  2. Choose VCS > Import into Version Control > Upload Project to Google Cloud.
  3. In the displayed dialog, select the Google Cloud Platform Console project ID associated with the project.

  4. Click Upload.

Clicking Upload performs a git commit to do an initial local commit, and then a git push to push those contents to the remote repository. Once this step is complete, you can start using your repository.

When you upload your source to Cloud Source Repositories, Android Studio by default uses "origin" as the remote name. If you already have a local Git repository set up with a remote configured, the upload will succeed, but will choose "cloud-platform" as the remote name to avoid a name conflict.

Browsing the source

Once you’ve uploaded your source code, you can browse the source in the Google Cloud Platform Console:

  1. In the Google Cloud Platform Console, select the project that has the project ID you specified in the previous step.
  2. In the left navigation bar, select Source Code > Browse.

Checking out source

To check out source from Cloud Source Repositories in Android Studio:

NOTE: Our IDE Cloud Source Repository integration only supports checking out the 'default' repository. Please check our previous instructions on uploading source to create one.

  1. Choose VCS > Checkout from Version Control > Google Cloud.

  2. In the displayed dialog, select the Google Cloud Platform Console project ID associated with the project and click Clone.

You can alternatively check out from the Welcome screen by selecting your project and then selecting Check out project from Version Control > Google Cloud.

Where to go from here

As mentioned above, the front end for Cloud Source Repositories is Git. Once you've put your project into Cloud Source Repositories, you can use the toolbar or regular git commands to perform operations such as commit, push, and pull to the source. See git-scm.com for more information on using Git as a source control manager.

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Tools for Android Studio