How to Start with Git – Step by Step

Many people mix between Git and GitHub and may think they are both the same, but this isn’t true.  Let’s see the difference between them and how to start with Git.

Difference between Git and GitHub:

Git is a version control system (i.e., a piece of software) that helps you keep track of your computer programs and files and the changes that are made to them over time. It also allows you to collaborate with your peers on a program, code, or file. GitHub and similar services (including GitLab and BitBucket) are websites that host a Git server program to hold your code.

If it’s the first time to use Git you need to follow the next steps to have your new account.

How to start with Git?

Step 1: Create a GitHub account

To start with Git you need to create a GitHub account, from ”” for free.

How to start with Git?
How to start with Git?

Pick a username (e.g., octocat123), enter your email address and a password, and click Sign up for GitHub.

Step 2: Create a new repository

  • Create a Git repository to store code, just select New Repository from the + sign dropdown menu.
How to start with Git?
How to start with Git?
  • Enter a name for your repository (e.g, “Demo”) and click Create Repository.
  • Now you have set up your first repo on

Step 3:Create a file

  • Once your repo is created, it will look like this:

  • Look at the section that starts “…or create a new repository on the command line,” and ignore the rest for now.
  • Open the Terminal program on your computer.

Type git and hit Enter. If it says command bash: git: command not found, then install Git with the command for your Linux operating system or distribution. Check the installation by typing git and hitting Enter; if it’s installed, you should see a bunch of information about how you can use the command.

In the terminal, type:

mkdir Demo

This command will create a directory (or folder) named Demo.

Change your terminal to the Demo directory with the command:

cd Demo

Then enter:

echo "#Demo" >>

This creates a file named README.mdand writes #Demoin it. To check that the file was created successfully, enter:


This will show you what is inside the file, if the file was created correctly. Your terminal will look like this:

To tell your computer that Demo is a directory managed by the Git program, enter:

git init

Then, to tell the Git program you care about this file and want to track any changes from this point forward, enter:

git add

Step 4: Make a commit

So far you’ve created a file and told Git about it, and now it’s time to create a commit. Commit can be thought of as a milestone. Every time you accomplish some work, you can write a Git commit to store that version of your file, so you can go back later and see what it looked like at that point in time. Whenever you make a change to your file, you create a new version of that file, different from the previous one.

To make a commit, enter:

git commit -m "first commit"

That’s it! You just created a Git commit and included a message that says first commit.

Step 5: Connect your GitHub repo with your computer

git remote add origin<your_username>/Demo.git

Now we have connected our local copy of the Demo repository to its remote counterpart on Your terminal looks like this:

Now that we have added the remote, we can push our code (i.e., upload our file) to

Once you are done, your terminal will look like this:

And if you go to<your_username>/Demo you will see something like this:

That’s all! You have created your first GitHub repo


Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button