Skip to content

hosstyle-jpn/skills-code-with-codespaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code with GitHub Codespaces and Visual Studio Code

Develop code using GitHub Codespaces and Visual Studio Code!

Step 1: Create your first codespace and push code

Welcome to "Develop code using GitHub Codespaces and Visual Studio Code"! 👋

What's the big deal about using a codespace for software development? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your project. Each codespace you create is hosted by GitHub in a Docker container that runs on a virtual machine. You can choose the type of machine you want to use depending on the resources you need.

GitHub offers a range of features to help your development team customize a codespace to reach peak configuration and performance needs. For example, you can:

  • Create a codespace from your repository.
  • Push code from the codespace to your repository.
  • Use VS Code to develop code.
  • Customize the codespace with custom images.
  • Manage the codespace.

To begin developing using GitHub Codespaces, you can create a codespace from a template or from any branch or commit in a repository. When you create a codespace from a template, you can start from a blank template or choose a template suitable for the work you're doing.

⌨️ Activity: Start a codespace

We recommend opening another browser tab to work through the following activities so you can keep these instructions open for reference.

  1. Start from the landing page of your repository.

  2. Click the green Code button located in the middle of the page.

  3. Select the Codespaces tab in the box that pops up and then click the Create codespace on main button.

    Wait about 2 minutes for the codespace to spin itself up. Note: It's a virtual machine spinning up in the background.

  4. Verify your codespace is running. The browser should contain a VS Code web-based editor and a terminal should be present such as the below: codespace1

⌨️ Activity: Push code to your repository from the codespace

  1. From inside the codespace in the VS Code explorer window, select the index.html file.

  2. Replace the h1 header with the below:

    <h1>Hello from the codespace!</h1>
  3. Save the file.

    Note: The file should autosave.

  4. Use the VS Code terminal to commit the file change by entering the following commit message:

    git commit -a -m "Adding hello from the codespace!"
  5. Push the changes back to your repository. From the VS Code terminal, enter:

    git push
  6. Your code has been pushed to your repository!

  7. Switch back to the homepage of your repository and view the index.html to verify the new code was pushed to your repository.

  8. Wait about 20 seconds then refresh this page (the one you're following instructions from). GitHub Actions will automatically update to the next step.


Get help: Post in our discussion boardReview the GitHub status page

© 2023 GitHub • Code of ConductMIT License

About

My clone repository

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages