Setting Up a Repository

A default Cloud Source Repository is created the first time you visit your project's Source Code page.

You can also create additional new repositories as required.

Membership and permissions for Cloud Source Repositories are inherited from the Cloud Platform Console project.

Before you begin

Select or create a Cloud Platform project.

Go to the Manage resources page

Creating a new repository

To create a new repository:

Console

  1. Open the source view in the Cloud Platform Console:

    Open the Source View in the Console

  2. Click Repositories in the left-hand navigation bar.

  3. Click Create Repository.

    Create Repository button

  4. Enter a name for the repository when prompted and click Create.

gcloud

From the command line, call:

gcloud init
gcloud alpha source repos create REPO_NAME

The response looks like:

Created [<Repo
 createTime: u'2016-06-02T00:43:16.978546Z'
 id: u'vhgpLUdCAVc'
 name: u'myrepo'
 projectId: u'google-cloud-example'
 state: StateValueValuesEnum(LIVE, 1)
 vcs: VcsValueValuesEnum(GIT, 1)>].
createTime: '2016-06-02T00:43:16.978546Z'
id: vhgpLUdCAVc
name: myrepo
projectId: google-cloud-example
state: LIVE
vcs: GIT

Adding project members and setting permissions

Cloud Source Repositories inherit membership and access control permissions from the associated Cloud Platform Console project. Members of the project with Owner or Editor roles can push source code to the repository, and view and edit repository contents. Members with Viewer roles can view or pull repository contents only.

To add project members and set permissions:

  1. Open the IAM & Admin page in the Cloud Platform Console.

    Open the IAM & Admin page

  2. Select your project and click Continue.

  3. Add each collaborator on your project as a project member and assign Owner, Editor or Viewer roles.

What's next

After you have set up the Cloud Source Repository, the next step is to add a Cloud Source repository as a remote or connect a hosted Git repository.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Source Repositories