You can use Cloud Source Repositories to create a new, empty repository. Creating a repository is useful when you want to start a project or back up a Git repository using Cloud Source Repositories.
Before you begin
Create a new repository
You can create a repository by using either the Google Cloud Console or the
In the GCP Console, open Cloud Source Repositories.
Click Add repository.
The Add a repository page opens.
Select Create new repository and click Continue.
The Create new repository page opens.
In the Repository name field, type a name for the new repository.
In the Project drop-down list, select the Google Cloud project the repository belongs to.
To create a new Google Cloud project, click Create project.
Your repository is created, and the Add code to your repository page opens. This page provides instructions on how to clone the repository to your local machine or push code from an existing repository based on your authentication type.
From the command line, call:
gcloud init gcloud source repos create [REPO_NAME]
[REPO_NAME] is the name for your repository.
Create a project
All repositories must belong to a Google Cloud project. If you don't have a Google Cloud project, you can create one by following these steps.
On the Create new repository page, click Create project.
The Create Cloud project dialog opens.
In the Project name field, type a name for the Google Cloud project.
In the Project ID field, either accept the generated project ID or click Edit Project ID to enter a different one.
In the Billing Account drop-down list, select a billing account.
To create a billing account, click Create billing account.
You can continue creating a new repository.
Now that you have a repository in Cloud Source Repositories, you can now add your code, which might involve either of these processes:
- Cloning your new repository to your local machine.
- Pushing code from an existing repository on your local machine.