Installing git and some useful shell commands

Installing git and some useful shell commands#

Learning Objectives#

After working through this topic, you should be able to:

  • install git on your local machine

  • set the username and user email for git

  • list, create and delete files from the command line

Installation#

  • Git often comes pre-installed on Linux and MacOS.

  • If on Linux, we assume you know what you are doing.

  • If on the Mac, see the section below.

  • If on Windows, note that some of the specifics in the video might be a bit dated. Basically, however, it is a matter of going to git-scm.com and following the instructions.

    Following the instructions will involve the use of a shell / terminal. In case you have never seen one before, first go through Navigation in the windows shell

MacOS specifics#

Make sure you have the Xcode Command Line Tools installed, which already includes git. Check if these tools are already installed by running in the Terminal (see Navigation in the unix shell if you do not understand what we mean):

xcode-select -p
  • If they are not installed you will see xcode-select: error: unable to get active developer directory....

  • You can check the output meaning here.

You can install Xcode Tools with:

xcode-select --install

Notes#

  • Setting the username and email is not optional!

  • You can skip the command line intro if you have seen the shell screencasts.

  • The video recommends some outdated programs. Stick to what we recommended.

Additional configuration#

Sometimes git will open a code editor in which you can type a commit message or some other message. On most operating systems, the default editor for this is a command line editor like vim or nano that is hard to use. We recommend that you set it instead to vscode with the following command:

git config --global core.editor "code"

Materials#

For this topic we are building on the excellent YouTube playlist by NetNinja

Quiz#