Debian / Ubuntu Linux: HowTo Download A Git Repository

in Categories , , last updated September 6, 2015

I would like to install something from source code. The site says that I need to download it from git repository. How do I download a git repository under a Debian / Ubuntu Linux?

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. You need to install git and git-core packages under a Debian or Ubuntu Linux.

In this quick tutorial you will learn how to clone a git repo and compile software on your local GNU/Linux system.


Type the following apt-get command to install the same:
# apt-get install git git-core
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-75 linux-headers-3.2.0-77 linux-headers-3.2.0-77-virtual
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  git-man liberror-perl
Suggested packages:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn
  git-email git-gui gitk gitweb
The following NEW packages will be installed:
  git git-core git-man liberror-perl
0 upgraded, 4 newly installed, 0 to remove and 2 not upgraded.
Need to get 6,752 kB of archives.
After this operation, 15.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 precise/main liberror-perl all 0.17-1 [23.8 kB]
Get:2 precise-updates/main git-man all 1: [631 kB]
Get:3 precise-updates/main git amd64 1: [6,097 kB]
Get:4 precise-updates/main git-core all 1: [1,380 B]
Fetched 6,752 kB in 0s (25.2 MB/s)
Selecting previously unselected package liberror-perl.
(Reading database ... 223212 files and directories currently installed.)
Unpacking liberror-perl (from .../liberror-perl_0.17-1_all.deb) ...
Selecting previously unselected package git-man.
Unpacking git-man (from .../git-man_1%3a1.7.9.5-1ubuntu0.1_all.deb) ...
Selecting previously unselected package git.
Unpacking git (from .../git_1%3a1.7.9.5-1ubuntu0.1_amd64.deb) ...
Selecting previously unselected package git-core.
Unpacking git-core (from .../git-core_1%3a1.7.9.5-1ubuntu0.1_all.deb) ...
Processing triggers for man-db ...
Setting up liberror-perl (0.17-1) ...
Setting up git-man (1: ...
Setting up git (1: ...
Setting up git-core (1: ...


The syntax is as follows:

git clone git://

In this example I’m going to clone emerald so that I can build it locally:
$ cd ~/buildtests
$ git clone git://

Sample outputs:

Cloning into emerald...
remote: Counting objects: 2272, done.
remote: Compressing objects: 100% (2221/2221), done.
remote: Total 2272 (delta 1622), reused 0 (delta 0)
Receiving objects: 100% (2272/2272), 859.78 KiB | 255 KiB/s, done.
Resolving deltas: 100% (1622/1622), done.

cd into emerald and list the files, enter:
$ cd emerald
$ ls -l

Sample outputs:

total 124
-rw-r--r-- 1 vivek vivek  1903 Jul 18 23:29 AUTHORS
-rwxr-xr-x 1 vivek vivek   261 Jul 18 23:29
-rw-r--r-- 1 vivek vivek    21 Jul 18 23:29 ChangeLog
-rw-r--r-- 1 vivek vivek  2438 Jul 18 23:29
-rw-r--r-- 1 vivek vivek 18002 Jul 18 23:29 COPYING
drwxr-xr-x 3 vivek vivek  4096 Jul 18 23:29 defaults
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 doc
-rw-r--r-- 1 vivek vivek 15590 Jul 18 23:29 emerald.po
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 engines
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 include
-rw-r--r-- 1 vivek vivek  9498 Jul 18 23:29 INSTALL
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 libengine
-rw-r--r-- 1 vivek vivek   259 Jul 18 23:29
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 misc
-rw-r--r-- 1 vivek vivek    31 Jul 18 23:29 NEWS
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 pixmaps
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 po
-rw-r--r-- 1 vivek vivek   276 Jul 18 23:29 README
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 src
drwxr-xr-x 2 vivek vivek  4096 Jul 18 23:29 themer
-rw-r--r-- 1 vivek vivek   261 Jul 18 23:29 TODO
-rw-r--r-- 1 vivek vivek    14 Jul 18 23:29 VERSION

You just cloned emerald from from Git to your local machine. You can make modifications and push changes, or just build the software:
$ ./configure --options
$ make
$ sudo make install

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 2 comments/add one below):

2 comment

  1. Useless article whithout describing howto:
    >You can make modifications and push changes, or just build the software.
    “git clone” already decribed almost on every open source software homepage.

    And not «just build», but *properly* for Ubuntu/Debian build and install.

    Have a question? Post it on our forum!