Setting Up a Repository

You can create repositories as required.

Membership and permissions for Cloud Source Repositories are inherited from the GCP 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:


  1. Open the source view in the GCP 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.


From the command line, call:

gcloud init
gcloud 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 GCP 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 GCP 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.

Send feedback about...

Cloud Source Repositories