How to create new repository in self hosted Git Server

How to create new repository in self hosted Git Server

In this tutorial we will learn,how to create new repository in self hosted Git Server.Previously, I have written a post on setting own git server in CentOS and Ubuntu.

Follow the given below steps to create new repo in self hosted Git Server

Step 1: Login to Server with root and then switch to Git Server user which maintains the Git.

Note: Here, existing user name is git,which we are using in Git Server,if you have any other user replace the word git from command

ssh root@server-IP-address

su -l git     

Step 2: Now change to repository directory. Create a new directory for repository (use .git as suffix with repo name,eg. test-repo.git)
Change to new repo directory and initialize the git for the new repo.And then run the command
git update-server-info for updating the Git Server information.


$ cd repositories
$ mkdir test-repo.git
$ cd test-repo.git
$ git --bare init
$ git update-server-info

Now new git repository is created.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.