Creating an empty repository

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:

Console

  1. Open Cloud Source Repositories in the console:

Open Cloud Source Repositories

  1. Click Add Repository, located in the top right corner.

    The New Repository screen opens.

  2. Select Create New Repository.

  3. Click Continue.

    The Create New Repository screen opens.

  4. Type a name for the new repository in the Repository Name box.

  5. Select the GCP project the repository belongs to from the Project list.

    To create a new project, click Create Project.

  6. Click Create.

gcloud

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

After you create your repository, a new screen opens. This screen provides instructions on how to clone the repository to your local machine or push code from an existing repository.

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:

  1. From the New Repository screen, type a name for your new repository.

  2. Click Create Project.

    The Create Cloud Project dialog box opens.

  3. Type a name for the new project in the Project Name box.

  4. In the Project ID box, either accept the generated project ID or type a new one.

    Note: The Project ID must be unique.

  5. Select a billing account from the Billing Account list.

    To create a new billing account, click Create Billing Account.

  6. Click Create.

You can now continue to create a new repository.

What's next

Now that you have a new repository in Cloud Source Repositories, your next step is to add code. You can either:

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Source Repositories