Skip to main content
GitHub Docs
  • All products
  • GitHub Codespaces
    • Overview
    • Getting started
      • Quickstart for Codespaces
      • Deep dive into Codespaces
    • Developing in a codespace
      • Codespaces lifecycle
      • Create a codespace
      • Develop in a codespace
      • Source control
      • Pull requests
      • Delete a codespace
      • Forward ports
      • Default environment variables
      • Connecting to a private network
      • Visual Studio Code
      • GitHub CLI
    • Setting up your repository
      • Introduction to dev containers
      • Add a dev container to your repository
      • Set a minimum machine spec
    • Customizing your codespace
      • Personalize your codespaces
      • Change the machine type
      • Set the default editor
      • Set the default region
      • Set the timeout
      • Configure automatic deletion
    • Prebuilding your codespaces
      • About prebuilds
      • Configure prebuilds
      • Allow external repo access
      • Manage prebuilds
      • Test dev container changes
    • Managing your codespaces
      • Encrypted secrets
      • Repository access
      • Security logs
      • GPG verification
    • Managing your organization
      • Enable Codespaces
      • Manage billing
      • Encrypted secrets
      • Repository access
      • Audit logs
      • Restrict machine types
      • Restrict port visibility
      • Restrict timeout periods
      • Restrict the retention period
    • Reference
      • Understanding billing
      • Private image registry
      • Copilot in Codespaces
      • VS Code Command Palette
      • Security in Codespaces
      • Disaster recovery
    • Troubleshooting
      • Codespaces logs
      • Exporting changes
      • Creation and deletion
      • Connection
      • Codespaces prebuilds
      • Dotfiles
      • Port forwarding
      • Codespaces clients
      • Working with support
    • Web-based editor
    • Guides
  • GitHub Codespaces/
  • Getting started/
  • Quickstart for Codespaces
 
GitHub Docs
  • GitHub Codespaces/
  • Getting started/
  • Quickstart for Codespaces
GitHub Codespaces
    • Get started
    • Account and profile
    • Authentication
    • Repositories
    • Enterprise administrators
    • Billing and payments
    • Site policy
    • Organizations
    • Code security
    • Pull requests
    • GitHub Issues
    • GitHub Actions
    • GitHub Copilot
    • GitHub Codespaces
    • GitHub Packages
    • Search on GitHub
    • Developers
    • REST API
    • GraphQL API
    • GitHub CLI
    • GitHub Discussions
    • GitHub Sponsors
    • Building communities
    • GitHub Pages
    • Education
    • GitHub Desktop
    • GitHub Support
    • Atom
    • Electron
    • CodeQL
    • npm
Free, Pro, & Team
    • Free, Pro, & Team
    • Enterprise Cloud
    • About versions

 

Quickstart for GitHub Codespaces

In this article

  • Introduction
  • Creating your codespace
  • Running the application
  • Edit the application and view changes
  • Committing and pushing your changes
  • Personalizing with an extension
  • Next Steps
  • Further reading

Try out GitHub Codespaces in 5 minutes.

GitHub Codespaces is available for organizations using GitHub Team or GitHub Enterprise Cloud. For more information, see "GitHub's products."

Introduction

In this guide, you'll create a codespace from a template repository and explore some of the essential features available to you within the codespace.

From this quickstart, you'll learn how to create a codespace, connect to a forwarded port to view your running application, use version control in a codespace, and personalize your setup with extensions.

For more information on exactly how GitHub Codespaces works, see the companion guide "Deep dive into GitHub Codespaces."

Creating your codespace

  1. Navigate to the template repository and select Use this template.

  2. Choose an owner for the new repository, enter a repository name, select your preferred privacy setting, and click Create repository from template.

  3. Navigate to the main page of the newly created repository. Under the repository name, use the Code drop-down menu, and in the Codespaces tab, click Create codespace on main.

    New codespace button

Running the application

Once your codespace is created, your repository will be automatically cloned into it. Now you can run the application and launch it in a browser.

  1. When the terminal becomes available, enter the command npm run dev. This example uses a Node.js project, and this command runs the script labeled "dev" in the package.json file, which starts up the web application defined in the sample repository.

    npm run dev in terminal

    If you're following along with a different application type, enter the corresponding start command for that project.

  2. When your application starts, the codespace recognizes the port the application is running on and displays a prompt to let you know it has been forwarded.

    Port forwarding toast

  3. Click Open in Browser to view your running application in a new tab.

Edit the application and view changes

  1. Switch back to your codespace and open the haikus.json file by double-clicking it in the Explorer.

  2. Edit the text field of the first haiku to personalize the application with your own haiku.

  3. Go back to the running application tab in your browser and refresh to see your changes.

    If you've closed the tab, open the Ports panel and click the Open in browser icon for the running port.

    Port Forwarding Panel

Committing and pushing your changes

Now that you've made a few changes, you can use the integrated terminal or the source view to commit and push the changes back to the remote.

  1. In the Activity Bar, click the Source Control view. Source control view

  2. To stage your changes, click + next to the file you've changed, or next to Changes if you've changed multiple files and you want to stage them all.

    Source control side bar with staging button highlighted

  3. Type a commit message describing the change you've made.

    Source control side bar with a commit message

  4. To commit your staged changes, click the check mark at the top the source control side bar.

    Click the check mark icon

    You can push the changes you've made. This applies those changes to the upstream branch on the remote repository. You might want to do this if you're not yet ready to create a pull request, or if you prefer to create a pull request on GitHub.

  5. At the top of the side bar, click the ellipsis (...).

    Ellipsis button for View and More Actions

  6. In the drop-down menu, click Push.

  7. Go back to your new repository on GitHub and view the haikus.json file. Check that the change you made in your codespace has been successfully pushed to the repository.

Personalizing with an extension

Within a codespace, you have access to the Visual Studio Code Marketplace. For this example, you'll install an extension that alters the theme, but you can install any extension that is useful for your workflow.

Note: If you have Settings Sync turned on, any changes you make to your editor setup in the current codespace, such as changing your theme or keyboard bindings, are automatically synced to any other codespaces you open and any instances of Visual Studio Code that are signed into your GitHub account.

  1. In the left sidebar, click the Extensions icon.

  2. In the search bar, enter fairyfloss and install the fairyfloss extension.

    Add an extension

  3. Click Install in Codespaces.

  4. Select the fairyfloss theme by selecting it from the list.

    Select the fairyfloss theme

Next Steps

You've successfully created, personalized, and run your first application within a codespace but there's so much more to explore! Here are some helpful resources for taking your next steps with Codespaces.

  • Deep dive: This quickstart presented some of the features of Codespaces. The deep dive looks at these areas from a technical standpoint.
  • Setting up your project for Codespaces: These guides provide information on setting up your project to use Codespaces with specific languages.
  • Configuring Codespaces for your project: This guide provides details on creating a custom configuration for Codespaces for your project.

Further reading

  • Enabling Codespaces for your organization
  • Managing billing for Codespaces in your organization

Did this doc help you?

Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Or, learn how to contribute.

Still need help?

Provide GitHub Feedback
Contact support
  • © 2022 GitHub, Inc.
  • Terms
  • Privacy
  • Security
  • Status
  • Help
  • Contact GitHub
  • Pricing
  • Developer API
  • Training
  • Blog
  • About