An Introduction to Git and GitHub for newbies
Tags: github, newbie, tutorial, git
Published: 2021-02-28 11:17:46

---
title: An Introduction to Git and GitHub for newbies
published: true
description: 
tags: Github, Newbie, Tutorial, Git
//cover_image: https://miro.medium.com/max/875/0*UFKt2A0r8xxJTQV0
canonical_url: https://sameerkatija.medium.com/how-does-the-internet-work-d0c51f5422c3
---

If your job or interest is related to technology then you might have encountered the word “Git” or “Github”. So, What is this Git or GitHub, and why it’s so popular? Git is the most popular version control system.

Now you might ask, What is a version control system? A version control system (VCS) also known as revision control, source control, and source code management, record the changes made to our code in a special database called a repository. Think of a repository, or “repo” for short as a special kind of database or a storage location for software packages and is managed by the version control system to store all the versions and metadata that the project accumulates in the course of the project.

With VCS, we can look at our project history and look who has made what changes, when, and why? If something unusual and bad happens in between, we can revert the changes to the earlier project state. Without a VCS, we’ll have to consistently store the copies of the project in different folders, if we have more than one person working on the same code then it will be slow and unscaleable at all.

## Types of the Version control system.

There are two types of VCS. Centralized version control system and distributed control system. In centralized VCS, all the team members or people working on the same code connect to the central server to get the latest copy of the code, and to share their changes with others. The pitfall of centralized VCS is if the server goes offline, we can’t collaborate and save snapshots of our project. So, we have to wait until the project comes back online.

In Distributed Version control systems, we don’t have this problem. Every team member has a copy of the project with its history on their machine. So, we can save the snapshots of our project locally on our computer. If our server is offline, we can synchronize our work directly with others.
Git is the most popular distributed version control system. It’s free, open-source, fast, and scalable. Git is everywhere, almost 90% of the software projects use git. Therefore, almost every job description for software developers mentions git. So, if you are looking for a job as a software developer, then it’s the most valuable skill you must have on your resume.

Now we know what git is. So, let’s talk about Github. Github is a service, which provides hosting to store software projects and distributed version control systems using git. It offers source code management (SCM) functionality of Git and some of its features.

As we are more focused on learning git with GitHub because of its popularity and userbase. Before we go deeper, one thing we must clear in our minds is that we don’t need GitHub to use git, but we can’t use GitHub without using git. There are many alternatives to GitHub like GitLab and bitbucket. All of these are remote servers in “git jargon”. We will use these remote servers because they make sharing of code and scalability easy to do.

## Setup and installation.

You can download git from here and for installation, use these instructions (if it’s not already installed). We can use git using the command-line interface (CLI) and Graphical user interface (GUI). I prefer you to learn command-line first and then you can switch to GUI. The advantage of using the command-line is that 95% of other online git resources will be for the CLI.

After Setting up git on your system. Now it’s time to create an account on Github (You can use any other alternative to Github).
Configuring Git

If you are using git for the first time, on your pc you need some configuration. Let’s open git by pressing “Windows Key + s” and type git and open it. You will see a terminal window. Where you have to write basic commands.

We will need to add our identity to the git. so type the command given below and press enter to execute it.

``` 
git config — global user.name “Your Name”
git config — global user.email youremail@example.com
```

After executing these commands one by one, you will be asked to log in to your account or for your GitHub password. You are now set to start using git. For more information visit here.
Create a git repository

We can create a git repo on our local disk or on our remote server (Github). If we are trying to create a local repo then we need to navigate to the folder and right-click there and select “git bash here”. and type the following command.

![Right click photo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9ovt4lf67o6it391g3q.png)

``` git init ```

You have successfully initialized the local git repository.
Now if you need to work on a remote repository you need to create a repo by going to GitHub and create a repo by click on the plus button on the top right corner.

![Github profile picture](https://miro.medium.com/max/875/1*0RHF5jTSrikJmtu9DjEB5Q.png)

after creating a repo it will ask for the Repository name and Description and some other options and the “Create a repository” button at the end. For now, just give it a name and press the button and create a repo. After creating a repo you will some instructions.

![Github repo instructions](https://miro.medium.com/max/875/1*5EUEztzOuJYujsqaWjUJzg.png)

The highlighted text above is the address of your repo which you need to copy and clone on your pc. Navigate to the location where you need to clone (download) a repo to your local computer and press right-click and select “git bash here” and execute the following command.

```
git clone yourGitRepoAddress.
```

After cloning the repo into your local pc will recognize it as a git repo. For more information visit here.

## Conclusion
This was the basic introduction of git and git where we have learned to install the git, configure, and creating a repo. In the next article, we will learn about the basic operations of git.