What is Git

Git is a version control system (VCS) that is used for software development and other version control tasks. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.

Git was created by Linus Torvalds in 2005 for the development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer is Junio Hamano.

Run your own Git server

Git manages the version control of applications and there are many git repositories. All git repositories which are free is having some limitations.

GitHub is one of the great services but we can’t create private repository in  GitHub free . For Private repo, you have to pay minimum 7$ per month, and the expenses go up with more repos.

In cases you don’t want to pay any extra for version control then the best is to create your own Git server. Not only do you save costs, you also have more control over your server.

Install Git on your server

In this installation methods, we are going to use two host machines one for the server (Linux) where we are going to make our repository and another the local machine through which we are going to connect the git server so let start .

Step1 : Install Git In both machine

Server Machine:


Local Machine :

Linux  :

Windows :

Visit https://git-scm.com/ and download the latest version for your windows

Step2 : Install Git-core In server

Step3 : Create user : git

Step4 : Create SSH Key for local Linux machine (Optional)

Create ssh keys on your local machine to avoid asking password only for Linux Based Local System:

leave all as default by press Enter and save it in a secure location .

Now you have to copy these keys to the server so that the two machines can talk to each other. Run the following command on your local machine:

Step5 : Create a repository

Create a directory on your server machine and remember this will be your repository URL

Then change to this directory:

Then create an empty repo:

Step6 : Create a Git repo in local machine

Linux users can use Terminal and windows users should us GIT BASH

And change to this directory:

Now create the files that you need for the project in this directory.

Now add files to the repo:

Now write your commit message

Till now you were working on the local machines repo.Now we need to push this to our git server so that team can collaborate. To do this we need to push this to the remote location in our Git Server. To add the location need to type below command

Now you can push or pull changes between the server and local machine using the ‘push’ or ‘pull’ option:

Step7 :Cloning the repo with local machine

If there are other team members who want to work with the project they need to clone the repo from the server to their local machine:

Then change directory on the local machine (exchange project with the name of the project on your server):

Now they can edit files, write commit change messages and then push them to the server:

And then push changes: