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 Cloud Source Repositories in the console:
Click Add 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
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.
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: