Skip to main content

GitKit (2nd ed.): Learn git and GitHub in Context

Section 2.7 Your Development Environment

You have been assigned an issue to work on and you have created a fork of the upstream GitKit FarmData2 repository into your GitHub space.
To work on your issue you will need to setup a development environment. The development environment is where you will create your clone of the repository, where you will edit files, and where you will use Git commands to add your changes to your clone and push those changes to your origin.
Many FOSS contributors will setup the development environment on their personal machines. However, because student machines vary greatly the GitKit provides a browser-based development environment that you will access using your web browser. This development environment is guaranteed to be the same for everyone that uses it. It includes a code editor, development tools, and a few features designed specifically to help you stay on track when completing the GitKit’s hands-on exercises.
In this section you will create a new development environment, learn how to stop and restart the development environment, and do some necessary configuration of Git.

Subsection 2.7.1 Creating the Development Environment

The development environment will run in the cloud using a service called GitHub Codespaces, and you will access it using your web browser.

Exercises Exercises

1.
The following tasks will guide you through the process of creating the development environment.
(c)
Click the "Create new codespace" button on the page that appears.
(d)
Wait for the development environment to be created. Your browser window will refresh and change a few times during the creation process. Please be patient as this can take a few minutes.
After a few minutes, your browser window will look similar to Figure 2.7.1 including the prompt asking you to paste your GitHub Personal Access Token (PAT).
The GitKit Development Environment prompting for a GitHub PAT during creation.
Figure 2.7.1. The GitKit development environment prompting for a GitHub PAT during creation.
If you do not see the prompt asking you to paste your PAT after a few minutes try:
  • Reloading your browser tab.
  • Clearing your browser cache and reloading your browser tab.
  • Checking that your browser is fully supported by Codespaces
     2 
    docs.github.com/en/get-started/using-github/supported-browsers
    .
(e)
Paste the PAT that you created in Subsection 2.3.2 and press enter. Note, for security reasons your PAT is not displayed when it is pasted.
If you have lost or did not save your PAT, revisit Subsection 2.3.2 and create a new one.
(f)
After pasting your PAT, the development environment will finish being created. When the development environment is fully created your browser window will look similar to Figure 2.7.2 including the "Kit development environment is ready for use" message.
The GitKit Development Environment with the "Kit development environment is ready for use" message.
Figure 2.7.2. The GitKit development environment with the "Kit development environment is ready for use" message.

Subsection 2.7.2 Stopping the Development Environment

At some point you will complete an assignment or want to take a break and do other things. When you do so, you should stop the development environment. This will ensure that you do not consume more of your free Codespaces time than necessary.

Exercises

1.
Use the following steps to practice stopping the development environment.
(a)
Click on the word "Codespaces" in the bottom left of the browser window.
(b)
Select "Stop Current Codespace" from the menu that appears in the top center of the browser window.
(c)
Close the browser tab containing the development environment.

Subsection 2.7.3 Re-starting the Development Environment

When you return to work after stopping the development environment, you will need to restart it.

Exercises

1.
Use the following steps to restart the development environment.
(b)
Click the "Resume this codespace" button.
Do not click the "Create a new one" button because a new development environment will not contain any of your prior work.
(c)
Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use" and your browser window will look similar to Figure 2.7.3.
The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message.
Figure 2.7.3. The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message.

Subsection 2.7.4 The Git Client

Your development environment includes a Git client. The Git client is the tool that you will use to interact with Git repositories, such as the GitKit FarmData2 repository.
There are lots of different Git clients. Some are graphical and some use a text interface. These exercises, introduce you to Git using the text-based Git command line interface (CLI). This is the most general way to interact with Git and will provide a conceptual foundation for using any other Git client that you might encounter.

Exercises

1.
The Git CLI is accessed by using the git command in the terminal.
(a)
Using the git command without any additional arguments displays information about how to use git.
Enter the command git into the terminal in the development environment and press enter.
(b)
    Use the output from the git command in Task 2.7.4.1.a to determine which of the following commands will cause, git to "Show the working tree status."
  • git status
  • The git status command causes git to display the status of the working tree.
  • git tree
  • Check the output of the git command.
  • git working-tree
  • Check the output of the git command.
  • git show
  • Check the output of the git command.
Hint.
Check the output of the git command for the command that will "Show the working tree status."

Subsection 2.7.5 Configuring the Git Client

Git repositories maintain a complete history of all changes, including who made each change. To do this, Git needs to know a little bit of information about you.
Git identifies the author of each change using two pieces of information: A name and an email. For name, you might decide to use your full name, or a nickname, or your GitHub username. Just keep in mind that whatever name you use will be associated with all of the changes you make. For email, you can use any valid e-mail associated with you.
The exercises in this section will guide you through the process of configuring your name and email in the Git client in the development environment.

Exercises

1.
The git config --global user.name "<name>" command sets the name that Git will associate with your changes.
Give a command that will set the name you want to have associated with your changes by replacing <name> with the name you wish to use.
2.
The git config --global user.email "<email>" command sets the email address that Git will associate with your changes.
Give a command that will set the email you want to have associated with your changes by replacing <email> with the email address you wish to use.
3.
    Enter your commands from Exercise 2.7.5.1 and Exercise 2.7.5.2 into the Terminal.
    Then use the command git config --global --list to display the Git configuration. Examine the output and select all of the Git configuration keys that have values assigned to them.
  • user.name
  • user.name should be set to the name you used above.
  • user.email
  • user.email should be set to the email you used above.
  • core.editor
  • core.editor should be set to the nano editor.
  • git.user
  • git.user is not a setting.
  • gitkit.class
  • gitkit.class is not a setting.
You have attempted 1 of 5 activities on this page.