Git installation
Before you can use Git in VSCode or in the terminal it needs to be installed on your system. For macOS and Linux this means we have to use the terminal, but there's not a lot we have to do, so don't be dismayed if you're not used to it yet!
Install Git
{{ begin .windows }}
{{ .macos .linux }} Windows
On Windows, you install Git by downloading the installer from here and following the instructions.
If you are using Ubuntu WSL like we recommend you can install Git using Ubuntus package mangaer. In WSL run:
sudo apt-get install git
Then verify your install by running:
git --version
Note that this only installs Git for WSL and that the Windows installer we linked to only installs Git for Windows.
{{ end }}
{{ begin .macos }}
{{ .windows .linux }} MacOS
For MacOS users, there are two ways to install Git which we recommend.
-
The preferred way to install command line tools like Git on MacOS is with Homebrew. If you don't know what that is we recommend going back and reading about package managers in the previous chapter. If you do not want to use Homebrew, try the other method instead. In your terminal write:
brew install git
To confirm that Git has been installed correctly run the following. Then move on to the next step.
git --version
-
Use the Git bundled with XCode. Chances are that if you're going to program on a Mac, then you are going to have to install XCode's command-line tools at some point anyways. Git comes bundled with XCode's command-line tools. Check if you have it installed by opening a terminal and typing:
git --version
If you see something like the following, you've already got Git installed and can move on to the next step.
git version 2.33.0
If not, you need to install XCode's command-line tools (and its bundled Git). You can do so by running the following command:
xcode-select --install
Let this install, restart your terminal and type the following again. It should now display a version. Move on to the next step.
git --version
{{ end }}
{{ begin .linux }}
{{ .windows .macos }} Linux
The easiest way to install Git on your Linux machine is using your distro's package manager. On Ubuntu and Debian-based distros you will want to run the following in a terminal:
sudo apt install git
On Arch-based distros you want to run:
sudo pacman -S git
Then verify your install by running:
git --version
{{ end }}
Create an account on GitHub
When using Git you will want a place to store your repositories (projects, commonly called repos for short), the most popular site for this is called GitHub, but other alternatives include GitLab and BitBucket.
We recommend setting up a GitHub account, as it comes with some excellent student benefits. Sign up for an account here, and while you're at it sign up for the GitHub Student Developer Pack using your Chalmers email (cid@student.chalmers.se) here. The GitHub Student Developer Pack gives some good benefits for GitHub.
Chalmers GitLab
Chalmers also supplies its own GitLab instance where you log in with your CID. We highly recommend it for school projects as it doesn't require any extra setup. Important to note however is to not store personal projects there as you won't be able to access Chalmers' GitLab after you graduate, so keep this in mind.
You will also need to use this for at least one course during your bachelors, so it's at least worth remembering that it exists!