Skip to content

Installing git

First, check whether git is already installed on your system. To do this, start a command window (on Windows) or a terminal (on Mac or Linux) and type

1
git --version

Installation

If git is installed, the return message will tell you which version it is; if it is not installed, you will see an error message.

Otherwise, follow the instructions for your operating system.

Configuration

You can leave the majority of git's configuration settings with their default values. However, there are two settings that you may need to change globally. The first is your identity - this is important if you are going to collaborate with other people because it lets them know that it was you who made a particular change to a piece of code. You should use a name that clearly identifies you and cannot be mistaken for someone else. If the team you are working in has any kind of naming convention, find out what it is now and follow it. If your name was John Doe, you could use the following commands to set your identity:

1
2
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

The second setting you might want to change is your default editor. On Mac and Linux, there is a default editor set at the operating system level and git will use it. If you want to use something other than the OS default (emacs, for example), you can change it with the following command:

1
git config --global core.editor emacs

On Windows, you would need to use the full path to the editor executable in the git configuration command. For example, if you wanted to use Notepad++, you could specify your preference with the command below. Note that any other optional parameters can also be specified.

1
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

You can check your current git configuration by typing:

1
git config --list

Further reading

The majority of the git functions we need can be called from within PyCharm. If you want to know more about using git outside of PyCharm, please see the instructions on the git website.