Git Setup

This post is a brief introduction to using Git using the command-line tool git. You would enter these commands in a UNIX shell such as bash or zsh.

Git Setup

Once you have a bash shell with the git command, you set up your local git account with your full name and email. Here is how I set up my account:

You only need to set up your account once on a particular computer. You may have to set it up separately on Windwos and WSL.

You can then verify that you set it up correctly:

Git Local Repository Setup

Then you clone the repository. Cloning creates a local repository that is a copy of your repository at GitHub. For example, this is how to clone the demo Rainfall that I will show in the section 020:

Get the URL for your repository from GitHub.

Note GitHub requires a personal access token instead of the password for using git on the command line. See Creating a personal access token for how to do this and use it.

For the scopes of the personal access token, select the first one "repo Full control of private repositories".

Git Workflow on Rainfall

Commands for a basic Git workflow on rainfall.cpp:

  1. Edit files locally, e.g., add a header comment to the file rainfall.cpp
  2. Commit current changes to the local repository:
  1. Push your local commits to the GitHub repository: