Creating an empty repository

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

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project .

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project .

  6. Install the Google Cloud CLI.

  7. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  8. To initialize the gcloud CLI, run the following command:

    gcloud  
    init
  9. Verify that you have the latest version of Git .
  10. If you have not configured your user credentials in Git, follow the first time setup instructions.
  11. Enable the Cloud Source Repositories API.
  12. Enable the Cloud Source Repositories API

Create a new repository

You can create a repository by using either the Google Cloud console or the gcloud command-line tool.

Console

  1. In the Google Cloud console, open Cloud Source Repositories.

    Open Cloud Source Repositories

  2. Click Add repository.

    The Add a repositorypage opens.

  3. Select Create new repositoryand click Continue.

    The Create new repositorypage opens.

  4. In the Repository namefield, type a name for the new repository. Note that the names All-Users and All-Projects are restricted names and cannot be used.

  5. In the Projectdrop-down list, select the Google Cloud project the repository belongs to.

    To create a new Google Cloud project , click Create project.

  6. Click Create.

    Your repository is created, and the Add code to your repositorypage 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.

gcloud

  1. From the command line, call:

      gcloud 
      
     init 
     gcloud 
      
     source 
      
     repos 
      
     create 
      
     [ 
     REPO_NAME 
     ] 
     
    

    Where [REPO_NAME] is the name for your repository. Note that the names All-Users and All-Projects are restricted names and cannot be used.

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.

  1. On the Create new repository page , click Create project.

    The Create Cloud projectdialog opens.

  2. In the Project namefield, type a name for the Google Cloud project.

  3. In the Project IDfield, either accept the generated project ID or click Edit Project IDto enter a different one.

  4. In the Billing Accountdrop-down list, select a billing account.

    To create a billing account, click Create billing account.

  5. Click Create.

You can continue creating a new repository .

What's next

Now that you have a repository in Cloud Source Repositories, you can now add your code, which might involve either of these processes:

Create a Mobile Website
View Site in Mobile | Classic
Share by: