Skip to content

Week 0: Introduction to Git and GitHub

Divyansh Kulshreshtha edited this page Mar 5, 2022 · 3 revisions

Week 0: Introduction to Git and GitHub

What is Github?

GitHub is a web-based cloud service to host your source code. Think of it like google drive, but for your code base. Each project on your GitHub is called a "repository".

What is Git?

Git is a free and open source version control system designed to handle everything from small to very large projects with speed and efficiency. Git lets you interact with services like GitHub, Gitlab etc. It becomes very useful when working in larger teams, it makes every developer's life easier and hence is a very important skill to know about. Git has some commands that you can utilise to efficiently work with Github, we will get to those later, lets first install git on your system.

How to Install Git and Github

Installing Git on Windows

Installing Git on Linux

Most Linux distributions come with git pre-installed, try running: git --version to verify if it exists on your system. image

An output like this implies that git is installed correctly. If you get an error, or if the version seems too old, continue with the installation described below

Installation on Linux, steps

Determine which Linux distribution your system is based on. See List of Linux distributions – Wikipedia for a list of different Linux Distributions. Most Linux systems – including Ubuntu – are Debian-based.

Debian-based Linux Systems

Open a terminal window. Copy & paste the following into the terminal window and hit Return. You may be prompted to enter your password.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git

You can use Git now.

Fedora/RPM based systems:

sudo dnf update
sudo dnf upgrade
sudo dnf install git

Installing Git on a Mac

Open a terminal window.

Step 1 – Install Homebrew

Homebrew simplifies the installation of software on the Mac OS X operating system.

Copy & paste the following into the terminal window and hit Return.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor

You will be offered to install the Command Line Developer Tools from Apple. Confirm by clicking Install. After the installation finished, continue installing Homebrew by hitting Return again.

Step 2 – Install Git

Copy & paste the following into the terminal window and hit Return.

brew install git

You can use Git now.

If running git --version returns an output like this, congratulations you have successfully installed git!

image

Here is a git commands cheat sheet for your reference

If all of this seems a little overwhelming, don't worry, we will guide you through using everything