Setting a git server in local area network


In this blog, we will learn to setup a git server in a system which will be accessible over the local area network.

First we have to setup SSH server to the system(Git Server), to provide access to other (git client) system. We will do this to get access to our git server, so git client will be able to push and pull code to git server. Both server and client have to install git as well.

Now create a user called ‘gitserver’ in Server and make sure clients can access this user without password.

Note: In this blog git server’s IP is 192.168.2.137 and client’s IP is 192.168.2.129.

Configurations at Server Side:

$ su gitserver
$ cd /opt/git
$ mkdir project.git
$ cd project.git
$ git init --bare

Note: This is to initialize empty Repository in /opt/git/project.git directory.

Configurations at Client Side:

$ cd project
$ git init
$ git add.
$ git commit -m "Initial Commit"
$ git remote add origin gitserver@192.168.2.137:/opt/git/project.git
$ git push origin master

Now other clients can simply clone the git by the following command:

$ git clone gitserver@192.168.2.137:/opt/git/project.git

The repository will be there in your system.

Advertisements

About pushpendupurkait

I am RHCE, DB2, Openstack certified. working on scala and AngularJs for Knoldus.
This entry was posted in git, github, knoldus, Scala. Bookmark the permalink.

2 Responses to Setting a git server in local area network

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s