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.
Creating a new repository
To create a new repository:
Open the source view in the Cloud Platform Console:
Click Repositories in the left-hand navigation bar.
Click Create Repository.
Enter a name for the repository when prompted and click Create.
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:
Open the IAM & Admin page in the Cloud Platform Console.
Select your project and click Continue.
Add each collaborator on your project as a project member and assign Owner, Editor or Viewer roles.
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.