1. Home
  2. Git
  3. Git Tutorial
  4. Git – Create Repository

Git – Create Repository

Generally users host there repository on online git management provider like Github.com, bitbucket.com and Gitlab.com. But you can also host your repository on your server without any management tool. This is helpful for small organizations with limited git repositories.

Follow below instructions to create your own bare repository and host on your Linux server. After that clone that repository to your local system for development purpose.

#1. Create System User

First create a new system user, This is a good practice to have separate user, which will be used to connect repository on server from client systems.

#2. Crete Bare Repository

Now create a git bare repository. This repository will be used as remote repository by developers. First we are creating a project directory. After that I will create our first git repository named app1.git inside project directory. Try to keep repository name ending with .git for better naming convention.

Now use following command to initialize repository. Do not forgot to use –bare keyword in command to create bare repository.

If you list files inside repository you will not find directory named .git due to bare repository, You will see their many files like below

#3. Access Repository From Developer System

Now you can make a clone of this repository from any clients system using the following command. This will ask for password of git user.

The next tutorial, you will learn how to setup key based ssh access and clone git repositories over ssh without password.

Tags ,
Was this article helpful to you? Yes 1 No