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 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:
- In Android Studio, open the project you want to add to Cloud Source Repositories.
- Choose VCS > Import into Version Control > Upload Project to Google Cloud.
In the displayed dialog, select the Google Cloud console project ID associated with the project.
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 console:
- In the Google Cloud console, select the project that has the project ID you specified in the previous step.
- 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.
Choose VCS > Checkout from Version Control > Google Cloud.
In the displayed dialog, select the Google Cloud 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.