Installing Git on Linux and setting up the server

For CentOS/Fedora:

yum install git

For Ubuntu/Debian:

apt-get install git

Install Git from the source
It is generally a good idea to install it from the source because you’ll get the most recent version.

Prior to installing Git itself, download all of the required dependancies:

yum install curl-devel expat-devel gettext-devel \ openssl-devel zlib-devel

apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \ libz-dev libssl-dev

Grab the latest Git source from the Git web site

Untar the file and switch into that directory

tar -zxf git-
cd git-

Then install

make prefix=/usr/local all
sudo make prefix=/usr/local install

If you need to update Git in the future, you can use Git itself to do it.

git clone git://

Set your user name and e-mail address

git config --global "Your name"
git config --global

You can see all of your settings with this command

git config --list

To Create an empty remote Git repository

mkdir my_project.git
cd project.git
git --bare init

Using your Git Server from your Local Computer

cd my_project
git init
git add *
git commit -m "My initial commit message"
git remote add origin
git push -u origin master

Team members can now clone and track the remote repository using the following:

git clone
cd my_project

One Comment on “Installing Git on Linux and setting up the server

Leave a Reply to Ronaldtync Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>