13 Git Setup
13.1 Introduction
Git is a version control system that helps track changes to your code and collaborate with others. See Git and Github for more information.
In this guide, you’ll learn how to install and configure Git for use with RStudio.
Note: If you are working in a campus computer lab or using Posit Cloud, Git is already installed. You do not need to install anything, but you do need to configure Git (see below).
More complete instructions can be found in the Install Git chapter of Happy Git and GitHub for the useR by Jenny Bryan. Additional help can be found on the Git Documentation site at 1.5 Getting Started - Installing Git.
13.2 Installing Git
13.2.1 Windows
- Download the Git installer from git-scm.com.
- Run the installer and accept the default settings.
- Ensure that “Git from the command line and also from 3rd-party software” is selected.
- For the default editor, you can leave it as Vim or choose another text editor.
- Complete the installation and restart your computer (if prompted).
13.2.2 macOS
-
Open the Terminal and type:
If Git is already installed, this will display the installed version.
-
If Git is not installed, you can install it using Homebrew:
If you do not have Homebrew installed, follow the instructions at brew.sh.
13.3 Configuring Git
Once Git is installed, you need to introduce yourself to Git by setting your name and email. This information is used to track your contributions.
13.3.1 Checking Your Git Configuration
Before setting up Git, check if you have already configured it: