How to Use Git on Linux

How to Use Git on Linux

If you have ever been active in the world of software development, you know the importance of keeping track of different versions of your project, which in turn helps you to keep that flow of development as well as to provide better usability. In addition, if you have ever approached experienced people in this field, they would prefer Git, in most cases. Technically speaking, Git is one widely used tool for distributed version control as well as source-code-management purposes with ease. On the other hand, GitHub is a hosting platform for software projects, which make use of Git for version controlling. So if you havent signed up for Github, we highly recommend you do so at

All repositories in the basic plan of GitHub are public whereas you will have to purchase the premium plan for building private repositories. Rather than a hosting services, the service is something further useful, as it helps in building a community-level development as well as easy publicizing of your software-development projects, based on Git. When both these projects are combined together, it brings an awesome solution for the easy management of your projects. Earlier, we had published one tutorial for using Git in your Windows-powered PC. Now, it is time for Linux, which is also from the open-source power. Hope this tutorial will help you in setting up the special environment in your Linux PC and enabling version controlling in an effective manner.

How to Use GitHub

Basics of Git

1. Creating a repository

You can create a repository on Github at, but you will need to be logged in on Github. If you dont have an account, you can create one at

Create GitHub Repo

Here you need to provide a name for your repository, and some description. You can choose to make your repo Public or Private.

2. Set up Your Repository

Once, you have created the repo, Github will provide the instructions to setup your repo with on your local machine.

Setup Repo

If you do not have Git setup on your machine, follow the instructions at Now lets, start with creating a directory and initializing Git.

Create Directory Git

Add a `index.php` file to our directory.

< ?php
echo "Hello git";

Now initialize the directory with: $ git init

Initialize the Directory

Add the files with: $ git add. (This will include all the files in our directory)

Git Add

Now lets make our first commit with: $ git commit -m “first commit”

Git Commit

Add the origin to our repository with: $ git remote add origin

Git Add Origin

Now lets, push the changes to our repository online: $ git push (this will save all our local changes to our repository online)

Git Push

The demo repository is available at Please comment, if you have any issues setting up Git on you local machine.

Join Our Email Newsletter

Like what you read here in this blog post? Get free blog updates in your Email!

About Virendra Rajput

Virendra Rajput is an avid programmer and hacker. He is a Co-Founder at Markitty. He is a hardcore Python programmer who is passionate about hacking with various APIs. In his spare time, he loves working on side-projects.

Virendra has written 6 awesome articles for us at TechLila.


  1. says

    I just reached to your new Post How to use GitHub on Linux. I know why we use GitHub but I never use it before. I just follow up your tutorial that you have tried to described. Its really nice and easy to use with your tutorial.

    Thanks for sharing useful tips and tutorial for new user of GitHub. Thanks again
    AbduL GhaFFaR recently posted – Online Business Management SoftwareMy Profile

  2. says

    Very nice tutorial
    I tried linux only one time and its not a good experience for me
    because you have to give too many commands…
    Is their any article that can make Linux using easy
    Then i can try Git…
    Anyway really good article and it help newbies

 Comment Policy

Your words are your own, so be nice and helpful if you can. Please, only use your REAL NAME, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please. You can wrap code in [lang-name][/lang-name] tags.

Tell us what you're thinking...

If you want a picture to show with your comment, then get Gravatar!

CommentLuv badge