Link

Getting Started

To get started using Git on Terminal, you will want to familiarize yourself with basic Terminal commands, install Git, set up a Git account and a default text editor.

Table of contents

  1. Basic Terminal Commands
  2. Git Installation
  3. Initialize Account
  4. Text Editor

Basic Terminal Commands

The following basic Terminal commands will allow you to navigate your computer’s working directory. Some of them will be used in this user documentation:

Change directory:

cd <path/to/directory/>

Move backwards a directory:

cd ..

List contents of directory:

ls "path/to/directory/" 

Open a file:

open <filename> 

Create a directory:

mkdir <new-directory-name> 

Git Installation

IconYou will know when Git has been successfully installed when the bashgit --version command the following result appears in Terminal: bashgit version <latest-version-number> (Apple Git-<version-number>)

To install Git:

  1. Open the Terminal application
  2. Check to see if git is already installed:
    git --version
    
  3. If it is not yet installed, you will be prompted to go ahead and install it.

Initialize Account

Configure your account by entering a username and email that you want to be associated with all activity through your account:

git config --global user.name "Your Name"
git config --global user.email "your@email.com"
IconThe ‘–global’ portion of the above two commands means you only have to enter this information once. After that, the system will associate your account with all Git activity. To override this with a different name and email address, re-enter the above two commands without ‘–global’ while working on a project.

Text Editor

It can be quite helpful to have access to a text editor graphical user interface through Git on Terminal.

IconWe recommend setting up Visual Studio Code (VS Code) as the default. Install VS Code for Mac here: https://code.visualstudio.com/docs?dv=osx

To set up VS Code as a default text editor:

  1. Enter:
    git config --global core.editor "code --wait"
    
  2. Edit the global configuration settings in VS Code:
    git config --global -e
    

Completed all the steps?

You will know if you have entered an incorrect command or not achieved the goals of this instruction set if you see any Terminal error messages. If so, please try the steps again or visit our ‘Troubleshooting’ page.