Summary and Setup
Introduction to Git and GitLab
This lesson provides an introduction to version control with Git and GitLab.
Summary
The lesson covers the basics of Git, including:
- Configuring Git
- The local workflow (staging, committing, etc.)
- Working with remotes
- Exploring the history of a project
- Collaborating with others
It also introduces GitLab as a platform for hosting and managing Git repositories.
Setup
The setup instructions for this lesson are specific to resources available at the University of Edinburgh. These instructions can be found in the setup guide.
This lesson is built with The Carpentries Workbench.
This lesson requires a few software packages to be installed on your computer. This page provides instructions on how to set them up.
Software Setup
This lesson uses Git, a text editor, R, and RStudio. Below are instructions for installing this software on different operating systems.
University of Edinburgh Resources
This lesson is designed to be used with resources provided by the University of Edinburgh. While the core concepts are general, some of the setup and examples are specific to the University’s IT environment.
- ECDF Gitlab: We will be using the University of Edinburgh’s GitLab service at https://git.ecdf.ed.ac.uk. You will need your University login to access this.
- VPN: To access the ECDF GitLab from off-campus, you will need to be connected to the University VPN.
- SSH Keys: You will need to set up SSH keys to securely connect to GitLab. Instructions are provided below.
If you are not a member of the University of Edinburgh, you can still follow this lesson by using the public GitLab service at https://gitlab.com and adapting the instructions accordingly.
Required Software
You will need to install the following software:
- A shell: A command-line interface to your computer.
- Git: The version control software.
- A text editor: For editing plain text files.
- R and RStudio: For running R code and as an interface to Git.
Windows
-
Shell:
- Download and install Git for Windows from git-scm.com.
- This will also install Git Bash, which provides a Unix-like shell.
-
Git:
- Git is included in the Git for Windows installation.
-
Text Editor:
- We recommend using a modern text editor like Visual Studio Code or Sublime Text.
- Notepad++ is also a good option.
-
R and RStudio:
- Install R from the Comprehensive R Archive Network (CRAN).
- Install RStudio Desktop (the free version) from the RStudio website.
-
SSH Keys:
- Open Git Bash and follow the instructions on the GitLab documentation to generate an SSH key.
- Add your public key to your ECDF GitLab account.
MacOS
-
Shell:
- The
Terminal.app
is included with macOS and is located in theUtilities
folder within yourApplications
folder.
- The
-
Git:
- Git is pre-installed on most recent versions of macOS. You can check
by opening the Terminal and typing
git --version
. - If it’s not installed, it will prompt you to install the Xcode Command Line Tools. Follow the prompts to do so.
- Git is pre-installed on most recent versions of macOS. You can check
by opening the Terminal and typing
-
Text Editor:
- We recommend using a modern text editor like Visual Studio Code or Sublime Text.
-
R and RStudio:
- Install R from the Comprehensive R Archive Network (CRAN).
- Install RStudio Desktop (the free version) from the RStudio website.
-
SSH Keys:
- Open the Terminal and follow the instructions on the GitLab documentation to generate an SSH key.
- Add your public key to your ECDF GitLab account.
Linux
-
Shell:
- The shell is pre-installed on all major Linux distributions (e.g., Bash, Zsh).
-
Git:
-
You can install Git using your distribution’s package manager. For example, on Debian/Ubuntu:
-
-
Text Editor:
- We recommend using a modern text editor like Visual Studio Code or Sublime Text.
- Your distribution will also come with a default text editor (e.g., Gedit, Kate).
-
R and RStudio:
- Install R from the Comprehensive R Archive Network (CRAN). Follow the instructions for your specific distribution.
- Install RStudio Desktop (the free version) from the RStudio website.
-
SSH Keys:
- Open a terminal and follow the instructions on the GitLab documentation to generate an SSH key.
- Add your public key to your ECDF GitLab account.