Basic setup

Last updated on 2024-06-26 | Edit this page

Overview

Questions

  • Do you have Git installed?
  • How to configure Git?
  • How to connect to GitHub?

Objectives

  • Have Git installed
  • Configure Git user information
  • Create a GitHub account
  • Create a SSH key to authenticate to GitHub

Installing Git


Check if you have Git installed with:

BASH

git --version

If not found, go to the offical Git download instructions and install Git. If you working on WSL2 Ubuntu, choose Linux/Unix, not Windows.

Configuring Git


You might have used Git without user configuration, e.g. when you just clone a repository from GitHub with git clone https://github.com/<XXX>/<YYY>.git. To be able to add code (“push”) in repositories, you will need to to configure user information.

Check if you have it already with:

BASH

git config --list

If user.name and user.email appear in the list, user configuration is done.

If not, configure user information with

BASH

git config --global user.name "[name]"
git config --global user.email "[email address]"

Replace [...] with your input, and keep the quotes around your name if there are spaces.

You can read more about configuring Git in https://coderefinery.github.io/git-intro/configuration/#configuring-git-command-line-and-editor

GitHub


Create a GitHub account

In this workshop, we will use GitHub as a “remote” repository. If you do not have a GitHub account yet, create one by following “Sign up” from the GitHub homepage. Note that the email address should match the one that you configured for local Git.

Generate a SSH key and add it to GitHub for authentication

To be able to push code to GitHub from your terminal, you will need to authenticate. SSH is the recommended method.

Check if you already have set it up:

BASH

ssh -T git@github.com

It is done, if you get:

OUTPUT

Hi yourusername! You've successfully authenticated, but GitHub does not provide shell access.

If not, follow these instructions:

Key Points

  • You need to configure Git user information for your local repository.
  • You can use an SSH key to authenticate your connection to GitHub from terminal.