Summary and Setup
Prerequisites
- Basic familiarity with Git and GitHub (see our introductory course)
 - A working local installation of Git
 - A local copy of the 
reciperepository - Complete the Setup before starting
 
About the RSE team
Your instructors are part of Imperial’s central Research Software Engineering (RSE) team, whose role is to improve the quality, impact and sustainability of research software. While most of our work is as hired coders and consultants on research projects, we also offer a number of free services, including training courses such as this one and one-to-one code surgeries, where you can get advice and support with software development.
You can find more information about our work and the services we offer on our website.
Minimum requirements
Completing this course requires:
- Access to a computer with Git installed
 - A GitHub account
 - A configured 
reciperepository - Be comfortable with using Git
 
This course is currently being delivered in person and remotely so please make sure you have access to a suitable computer.
Configure your recipe repository
If you have completed our Introduction
to using Git and GitHub for software development course, you should
have a recipe repository in your GitHub account that will
be used in this course. Specifically, in the lesson on Committing
and History from the Introduction course, we discuss how to set up
the recipe repository. Make sure you have a clone of that
repo in your local home directory.
If you have not completed the intro course:
- Download this zip archive
that contains the 
reciperepo with some previous commit history that will be used in the session. - Extract it into your home directory.
 - 
Create
a repository on your personal GitHub account and set it as the
remote for this 
reciperepository you have locally. 
Important
If you do not know how to set up a remote repo on GitHub, you can follow the steps in the “Configuring a remote repository from a local one” exercise in this lesson from intro course
Install Git
Important
If you do not already have Git installed or are not comfortable with using it for simple version control tasks, you should consider attending our Introduction to using Git and GitHub for software development course first.
Please follow the relevant instructions depending on your operating system.
- Download the Git for Windows installer.
 - Run the installer and follow the steps below:
 - Click on “Next” four times (two times if you’ve previously installed Git). You don’t need to change anything in the Information, location, components, and start menu screens.
 - From the dropdown menu select “Use the nano editor by default” and click on “Next”.
 - Select “Override the default branch name for new repositories” and use inclusive terms like “main” (Refer: The new Git default branch name)
 - Ensure that “Git from the command line and also from 3rd-party software” is selected and click on “Next”. (If you don’t do this Git Bash will not work properly, requiring you to remove the Git Bash installation, re-run the installer and to select the “Git from the command line and also from 3rd-party software” option.)
 - Ensure that “Use bundled OpenSSH” is selected and click on “Next”.
 - Ensure that “Use the native Windows Secure Channel library” is selected and click on “Next”.
 - Ensure that “Checkout Windows-style, commit Unix-style line endings” is selected and click on “Next”.
 - Ensure that “Use Windows’ default console window” is selected and click on “Next”.
 - Ensure that “Fast-forward or merge” is selected and click on “Next”.
 - Ensure that “Git Credential Manager” is selected and click on “Next”.
 - Ensure that “Enable file system caching” is selected and click on “Next”.
 - Ensure to select “Enable experimental built-in file system monitor” and click on “Install”.
 - Click on “Finish”.
 - If your “HOME” environment variable is not set (or you don’t know what this is):
 - Open command prompt (Open Start Menu then type 
cmdand press [Enter]) - Type the following line into the command prompt window exactly as
shown: 
setx HOME "%USERPROFILE%" - Press [Enter], you should see
SUCCESS: Specified value was saved. - Quit command prompt by typing 
exitthen pressing [Enter] 
This will provide you with both Git and Bash via the program Git
Bash. You should be able to launch Git Bash from the Start Menu. Within
the window that launches enter the command git --version
and press enter. You should see output similar to that below:
OUTPUT
git version 2.40.0.windows-1
Apple provide a suite of UNIX-style command line tools that includes git. Install them by opening the “Terminal” app and running:
commands, bash xcode-select --install
OUTPUT
xcode-select: note: install requested for command line developer tools
This will open a dialog that asks for your confirmation to install the tools. If it does not open a dialog, it may be because it is already installed (the error message will be clear).
To check the installation was successful, run the command:
commands, bash git --version
You should see output similar to that below:
OUTPUT
git version 2.37.1 (Apple Git-137.1)
If the above does not work, you may have and older
version of macOS. Try the following: install Git for Mac by downloading
and running the most recent “mavericks” installer from this
list. Because this installer is not signed by the developer, you may
have to right click (control click) on the .pkg file, click Open, and
click Open on the pop up window. After installing Git, there will not be
anything in your /Applications folder, as Git is a command
line program. For older versions of OS X (10.5-10.8)
use the most recent available installer labelled “snow-leopard”.
If Git is not already available on your machine you can try to install it via your distribution’s package manager.
For Debian/Ubuntu run:
commands, bash sudo apt-get install git
For Fedora run:
commands, bash sudo dnf install git
To check the installation was successful open a new terminal. In the window that launches enter the command:
commands, bash git --version
You should see output similar to that below:
OUTPUT
git version 2.40.0
Configure Git to use your preferred text editor
Many Git commands require you to provide input via a text editor
(though you can often skip this step with additional command-line
arguments). For example, running git commit by itself will
open a text editor to allow you to enter a commit message. Depending on
your OS and how you installed Git, the text editor Git will use can be
any number of things, but is likely to be either nano or vim, which are both terminal-based
editors. It is best to configure your preferred editor explicitly (if
you are using editor for the first time, it is advisable to use
nano).
To view the currently configured text editor, you can run:
commands, bash git config --global core.editor
(The output may be empty, indicating that no editor has been selected.)
If you would prefer to use a graphical text editor, there is useful documentation on GitHub on how to do this for some common editors.
If you would rather just use nano, you can run:
commands, bash git config --global core.editor nano