Shell and Git


Installing Git is not enough, you must also configure it and verify the configuration, otherwise you will start off behind! Please trust us that this is better verified before than during the workshop which we then cannot simply pause.

In CodeRefinery workshops, we use Bash (Unix Shell). If you have never been in a terminal shell, please briefly read this crash course, and consider watching this shell tutorial video by Richard Darst (20 min).

Git is a version control system that lets you track who made changes to what and when, and has options for updating a shared or public version of your code on source code repository hosting platforms such as GitHub or GitLab or Bitbucket.

Please follow the installation, configuration and verification instructions below.

What you need

Git installed and working from the command line, and configured.


You can follow the steps below by watching the Carpentries video tutorial.

  • Download the Git for Windows installer.

  • Run the installer and follow the steps below:

    1. Click on “Next” four times (two times if you’ve previously installed Git). You don’t need to change anything in the Information, location, components, and start menu screens.

    2. From the dropdown menu select “Use the Nano editor by default” (NOTE: you will need to scroll up to find it) and click on “Next”.

    3. On the page that says “Adjusting the name of the initial branch in new repositories”, ensure that “Let Git decide” is selected. This will ensure the highest level of compatibility for our lessons.

    4. Ensure that “Git from the command line and also from 3rd-party software” is selected and click on “Next”. (If you don’t do this Git Bash will not work properly, requiring you to remove the Git Bash installation, re-run the installer and to select the “Git from the command line and also from 3rd-party software” option.)

    5. Ensure that “Use the native Windows Secure Channel Library” is selected and click on “Next”.

    6. Ensure that “Checkout Windows-style, commit Unix-style line endings” is selected and click on “Next”.

    7. Ensure that “Use Windows’ default console window” is selected and click on “Next”.

    8. Ensure that “Default (fast-forward or merge) is selected and click “Next”

    9. Ensure that “Git Credential Manager Core” is selected and click on “Next”.

    10. Ensure that “Enable file system caching” is selected and click on “Next”.

    11. Click on “Install”.

    12. Click on “Finish” or “Next”.

  • If your “HOME” environment variable is not set (or you don’t know what this is):

    1. Open command prompt (Open Start Menu then type cmd and press enter)

    2. Type the following line into the command prompt window exactly as shown: setx HOME "%USERPROFILE%"

    3. Press enter, you should see SUCCESS: Specified value was saved.

    4. Quit command prompt by typing exit then pressing enter.

This will provide you with both Git and Bash in the Git Bash program. You can then start it by searching for “Git Bash” in your Start menu.

Text copied and adapted from: the Carpentries set up page



We assume that you have:

  • Signed up for a GitHub account

  • Bash (or Zsh on macOS) shell terminal on your machine

  • Git installed on your machine

  • Nano editor available (unless you prefer a different terminal editor)

Video instruction

This video (9 min) shows how to configure git, so first watch this. If you experience problems, watch this troubleshooting video.

The following shows the same steps that are shown in the video above.

Step 1: Setting user name and email

First, the following commands will set your user name and email address:

$ git config --global "Your Name"
$ git config --global

If you are unsure which email to use, use the one that you have registered at GitHub with.

This name and email will be public on GitHub when you make contributions, including in this course. If you prefer to not use a real email address but still want to make sure that GitHub counts your contributions, you can use (replace yourusername).

This is important since your Git commits use this information. The --global option uses this information for every repository for this user on this computer.

Step 2: Setting an editor

It is important to set also the default text editor to use with Git. We recommend to use nano if you do not have any other preferences (it is included and simple for demonstrations). But you can and should configure your preferred editor (VScode, vim, emacs or any other editor of your choice, see Text editors for git for more instructions):

This sets the editor to Nano:

$ git config --global core.editor nano

To set other editors, see Text editors for git

Step 3: SSH keys for GitHub

This is handled two steps from now, in SSH connection to GitHub, after you make a GitHub account.



We assume that you have:

  • Bash (or Zsh on macOS) shell terminal on your machine

  • Git installed and configured, with nano as its editor on your machine (unless you prefer a different terminal text editor)

The following shows the same steps that are shown in the video above. You can see verification part in the same video for configuration at 5:50.

Step 1: git init a new folder

Create a new example folder, step into it, and initialize a repository (don’t git init in your home directory):

$ mkdir example
$ cd example
$ git init

Step 2: Make a new file

Make a new file with some content:

$ nano example.txt

Write some text in the example.txt, save (ctrl+O then ENTER) and exit (ctrl+X).

Step 3: Stage the change

Stage a newly made file example.txt before committing the change and record in Git:

$ git add example.txt

Step 4: Commit the change with a message

The following command will commit the change. It should open the editor which you have configured. Then, add a commit message such as initial commit at the very top. Then save an exit (if you use the default nano editor, ctrl+O ENTER then ctrl+X):

$ git commit

Step 5: See the change log

$ git log

If you see now something line this (different name, email, and commit message), your Git is configured for the workshop:

commit 12e4cb892140bd14a413895b3b36c27db198eb22 (HEAD -> master)
Author: Radovan Bast <>
Date:   Fri May 15 16:41:13 2020 +0200

    making a test commit


Where is this configuration stored?

To see where this information is stored (--show-origin works on git version 2.8.0 or greater only), use:

$ git config --list --show-origin

On Windows git log, git diff, git branch or other git commands show no output at all

It seems this can be fixed by these configuration settings:

$ git config --global pager.log off
$ git config --global pager.diff off
$ git config --global off
$ git config --global pager.config off
$ git config --global pager.stash off
$ git config --global off
$ git config --global pager.blame off
$ git config --global pager.branch off
$ git config --global pager.annotate off

Following other manuals and documentation, it seems that all the above can be set with the following (cat should be available within Git Bash but also PowerShell):

$ git config --global core.pager cat