GIT and GitHub for Complete Beginners

Get started with GIT and GitHub as an absolute beginner

Are you new to programming and confused about Git and GitHub? This beginner’s guide will teach you the basics of these essential tools used by developers all over the world.

What is GIT?

Git is a software tool that helps developers keep track of changes they make to their code over time.

Git allows multiple developers to work on the same codebase simultaneously and makes it easy to revert to previous versions of the code if something goes wrong

Imagine you’re drawing a picture and you want to try something new, but you’re not sure if you’ll like it.

Git is like a magic tool that lets you make a copy of your picture before you try the new thing. If you don’t like the new thing, you can go back to the old picture and nothing is lost.

Developers use Git to make sure they don’t mess up their work and can go back to previous versions if they need t

What is GitHub?

GitHub is a web-based platform that allows developers to store, manage, and collaborate on their code, as well as track and control changes to their codebase.

GitHub is like a big toy box where lots of people can put their toys for others to play with.

People can also work together on the same program and make it better by fixing mistakes and adding new things. It’s kind of like building a big LEGO set with your friends.

How to Use Git and GitHub

Here are some steps to get started with Git and GitHub:

Step 1: Get a GitHub Account

The first step is to create a GitHub account which gives us access to all the features and tools of the platform.

To create a GitHub account, follow the steps below:

First, visit the GitHub website here and then click on the Sign up button in the top right corner.

Next, Enter your preferred email address, password, and username. Press the Continue button each time you enter any of the detail to proceed.

Choose a free individual account and complete the captcha. After that, click on the Create Account button to create your account.

Finally, check your email and follow the link in the confirmation email sent by GitHub to verify your account.

Your GitHub account is now ready and you can start using it to explore the site, create repositories, and collaborate with others.

Step 2: Download and Install Git

After getting a GitHub account, you will need to install Git on your local machine.

Below are the steps to correctly install Git for both Windows, Mac, and Linux machines.

Windows:

Go to the Git website here and download the Git for Windows installer.

Double-click the downloaded file to start the installation process.

Follow the prompts in the installer to complete the installation.

Once the installation is complete, open the command prompt and type git --version to verify that Git is installed and working correctly.

Mac:

Open Terminal, which can be found in the Utilities folder within the Applications folder. Type “xcode-select — install” in the terminal and follow the prompts to install the Xcode Command Line Tools.

Go to the Git website here and download the Mac installer.

Double-click the downloaded file to start the installation process. Next, follow the prompts in the installer to complete the installation.

Once the installation is complete, open the terminal and type “git — version” to verify that Git is installed and working correctly.

Linux:

Open the terminal and run the command sudo apt-get install git to install Git. Once the installation is complete, type git --version to verify that Git is installed and working correctly.

Step 3: Setup Git with GitHub

Now that you have created a GitHub account and installed Git, it’s time to set up Git with GitHub.

This is a crucial step that enables you to use Git to manage your code and collaborate with other developers on GitHub.

To set up Git with GitHub, follow the steps below:

Open the Git Bash terminal or command prompt on your computer.

Configure Git with your username and email address using the following commands:

Side Note: Replace “GitHub Username” with your actual GitHub username. Also, replace “ youremail@example.com” with your GitHub-connected email.

Next, Verify that your Git settings are correct by running the following command:

git config --list

This will display a list of your Git settings.

Set up an SSH key in Git Bash or command prompt by running the following command:

Follow the prompts to create a new SSH key. This will generate a public and private key pair.

Side Note: An SSH key provides you with an alternative way to access your GitHub account from the command line without the need to enter your username and password.

Adding SSH Key to GitHub Account

Add your SSH key to your GitHub account by copying the public key to your clipboard and then pasting it into your GitHub account settings.

To do that, first, log in to your GitHub account and then click on the dropdown menu at the top right corner. Next, click on Settings and then click on SSH and GPG keys.

Next, click on New SSH Key to add the SSH code you generated earlier from your computer.

Go to the folder where you stored the SSH file on your computer and open the (.pub) file using a text editor.

Copy all the text and paste it into the Key textbox below. Choose a title for your SSH Key and then click on Add SSH key to save.

Testing SSH Connections

Test your SSH connection to GitHub by running the following command in Git Bash or the command prompt:

If you see a message that says “Hi username! You’ve successfully authenticated…”, then your SSH connection is working correctly.

Conclusion

In this tutorial, we have explored the fundamentals of Git and GitHub for beginners, including creating a GitHub account, installing Git, and setting up Git with GitHub.

I believe this tutorial has provided you with a starter guide on Git and GitHub. In the next part of the tutorial, I will show you how to use Git and GitHub to contribute to Open-source projects.