You can use Google Cloud Source Repositories to create a new, empty repository. This is useful in situations where you are just starting a project or have an existing Git repository that you want to back up using Cloud Source Repositories.
Creating a new repository
To create a new repository:
Open the My Source view in the console:
Click New Repository, located in the top right corner.
The New Repository screen opens.
Select Create New Repository.
The Create New Repository screen opens.
Type a name for the new repository in the Repository Name box.
Select the GCP project the repository belongs to from the Project list.
To create a new project, click Create Project.
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
Creating a project
All repositories must belong to a GCP project. If you don't have an existing project for a repository, you can create one from the New Repository screen.
To create a new project:
From the New Repository screen, type a name for your new repository.
Click Create Project.
The Create Cloud Project dialog box opens.
Type a name for the new project in the Project Name box.
In the Project ID box, either accept the generated project ID or type a new one.
Note: The Project ID must be unique.
Select a billing account from the Billing Account list.
To create a new billing account, click Create Billing Account.
You can now continue to create a new repository.
Now that you have a new repository in Cloud Source Repositories, your next step is to add code. You can either: