Debian / Ubuntu Linux: HowTo Download A Git Repository

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?

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements git
Est. reading time 5m
[/donotprint]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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Oleg Jul 27, 2012 @ 8:52

    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.

  • Bob Jun 22, 2016 @ 7:35

    You skipped the most important part :/ this is useless

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum