How to install Git on Ubuntu Lucid (10.04)

I’m sure there are tons of blogs out there on the same subject. This is just like a reference for me and others out there who might stumble upon this post. Note that what I have documented here is what worked for me. At the time of writing the latest GIT version was 1.7.1

  1. First we install the dependent packages, thus you wont have to install the packages yourself.
  2. $ sudo aptitude build-dep git-core

  3. Download latest stable GIT release from here
  4. $ wget http://kernel.org/pub/software/scm/git/git-1.7.1.tar.gz

  5. Extract the archive and change to the extracted directory
  6. # tar xvzf git-1.7.1.tar.gz
    # cd git-1.7.1/

  7. Run the following
  8. $ ./configure
    $ make
    $ sudo make install

  9. Check installation and clean up
  10. $ git --version
    $ cd ../;rm -r git-1.7.1 git-1.7.1.tar.gz

About these ads
Tagged , , , , ,

68 thoughts on “How to install Git on Ubuntu Lucid (10.04)

  1. Jim Thanks says:

    Simple and concise. Thanks for this post.

  2. Terry says:

    Hi Kibet. I really like your blog. I am having some problems with your git how to. I am using a Lucid minimal install. I get this error when trying to make the package.

    terry@ubuntu:~/git-1.7.1$ make
    CC fast-import.o
    In file included from builtin.h:6,
    from fast-import.c:147:
    cache.h:17:18: error: zlib.h: No such file or directory
    In file included from builtin.h:6,
    from fast-import.c:147:
    cache.h:22: error: expected ‘)’ before ‘strm’
    cache.h:23: error: expected ‘)’ before ‘strm’
    cache.h:24: error: expected ‘)’ before ‘strm’
    fast-import.c:285: error: ‘Z_DEFAULT_COMPRESSION’ undeclared here (not in a function)
    fast-import.c: In function ‘store_object’:
    fast-import.c:996: error: ‘z_stream’ undeclared (first use in this function)
    fast-import.c:996: error: (Each undeclared identifier is reported only once
    fast-import.c:996: error: for each function it appears in.)
    fast-import.c:996: error: expected ‘;’ before ‘s’
    fast-import.c:1028: error: ‘s’ undeclared (first use in this function)
    fast-import.c:1039: error: ‘Z_FINISH’ undeclared (first use in this function)
    fast-import.c:1039: error: ‘Z_OK’ undeclared (first use in this function)
    fast-import.c: In function ‘stream_blob’:
    fast-import.c:1142: error: ‘z_stream’ undeclared (first use in this function)
    fast-import.c:1142: error: expected ‘;’ before ‘s’
    fast-import.c:1143: error: ‘Z_OK’ undeclared (first use in this function)
    fast-import.c:1165: error: ‘s’ undeclared (first use in this function)
    fast-import.c:1175: error: ‘Z_STREAM_END’ undeclared (first use in this function)
    fast-import.c:1188: error: ‘Z_FINISH’ undeclared (first use in this function)
    fast-import.c:1200: error: ‘Z_BUF_ERROR’ undeclared (first use in this function)
    fast-import.c: In function ‘git_pack_config’:
    fast-import.c:2846: error: ‘Z_BEST_COMPRESSION’ undeclared (first use in this function)
    make: *** [fast-import.o] Error 1

    • kibyegon says:

      Hi Terry, looking at the error message you got it seems that you are missing the zlib compression package needed by git.
      I’m assuming you did first install the dependent packages. If so, just do a $ sudo aptitude install zlib1g-dev .
      After that you should be fine.

      • Terry says:

        I was also missing tk but after a quick search of google I found gits dependencies and made sure I had everything.
        Thank you and keep up the great work.

      • kibyegon says:

        Thank you Terry, Ivan. Glad to hear that this helped someone out there.

  3. Ivan says:

    Thank you very much.
    It helped a lot indeed.
    Everything went as you said.

  4. Jeff says:

    Wow… very easy .. thanks

  5. Top Gear says:

    Simple and easy for understanding. Thanks for your work.

  6. gitfan says:

    I had to use sudo for all these commands.
    I use ubuntu.

    Why so?
    Should i create a new user for this and set some permissions ?
    If so, what are the steps ?

    thanks

    • kibyegon says:

      Hi gitfan,
      The reason why you have to use sudo is because the installation process needs to copy files to folders which are only writable to the root user or another user who has write permissions to these folders. The only other way not to use sudo is if the current user has the write permissions to these folders or you are logged in as root. So this also answers your second question. Creating another user solely for installing git? no, not necessary. ‘sudo’ is there just for these administrative tasks, so you wont have to log in as the superuser or root every time you need to install, or do anything that needs superuser privileges.

  7. Gulab Pasha says:

    Hi,

    I’m newbee to git.. Please help me configuring git with apache on ubuntu 10.04. so i can access my git through apache

    Thanks,
    Gulab Pasha

  8. Victor says:

    Hi I have a big problem with ubuntu 10.04 I am new in git and i would like to run the git daemon server.
    I have my git repository and i can watch it with git instaweb ( lighttpd already isntalled )

    the instructions in order to do that were:

    (server)$ touch /git/project.git/git-daemon-export-ok
    (server)$ sudo apt-get install xinetd
    (server)$ sudo vi /etc/xinetd.d/git

    service git
    {
    disable = no
    type = UNLISTED
    port = 9418
    socket_type = stream
    wait = no
    user = nobody
    server = /usr/bin/git-daemon
    server_args = –inetd –export-all –base-path=/git
    }

    (server)$ sudo /etc/init.d/xinetd restart

    This now gives us a public git repository url we can distribute to others.

    (client)$ git clone git://server/project.git

    but i Don’t have the /usr/bin/git-daemon in my computer any idea ?? please help me

    Thanks

    VIctor

  9. Anders Kaseorg says:

    The latest stable release of Git is always packaged in the git-core PPA for all versions of Ubuntu, so you don’t need to build it yourself.

    Just run
    sudo add-apt-repository ppa:git-core/ppa
    sudo aptitude update
    sudo aptitude full-upgrade

  10. Victor says:

    Hey i finally could find the solution to my problem

    here is the ubuntu forum in order to check i described as much as i could

    thanks kibyegon for your help this tutorial help me a lot in the beginning

    http://ubuntuforums.org/showthread.php?p=9645200#post9645200

    Thanks for all

    Sincerely yours

    Victor Rodriguez

  11. Silver Spoon says:

    Great blog. Simple and concise.

  12. Aj says:

    Thank you!
    This was helpful

  13. Jose says:

    Hi. Why are you installing both from source and the deb package git-core?

    • kibyegon says:

      @Jose, the reason why you install git-core from deb repository is because git-core provides the primary components of git. If I only install git from source, it wouldn’t work because git as an application requires certain capabilities which git source you get from the git website wouldn’t give you. There are other git applications such as git-arch, git-svn and git-arch which use the primary git package ‘git-core’ as their base. If you do not want to get yourself dirty with installing from source, There are pretty recent packaged git binaries for you, thanks to Anders Karseorg. Just check out his comments on this same post.

  14. Roman P. says:

    Thanks a lot sir for perfect article. It was really useful for me.

  15. rokon says:

    Hi,

    I’m newbee to git.. I was trying to install git in ubuntu 10.04 .

    Can you tell me why these type error going on here ..

    rokon@rokon-laptop:~/git-1.7.1$ ./configure
    ./configure: line 1507: config.log: Permission denied
    ./configure: line 1517: config.log: Permission denied
    rokon@rokon-laptop:~/git-1.7.1$ make
    CC fast-import.o
    In file included from builtin.h:4,
    from fast-import.c:147:
    git-compat-util.h:140:25: error: openssl/ssl.h: No such file or directory
    git-compat-util.h:141:25: error: openssl/err.h: No such file or directory
    In file included from builtin.h:6,
    from fast-import.c:147:
    cache.h:9:21: error: openssl/sha.h: No such file or directory
    In file included from fast-import.c:156:
    csum-file.h:10: error: expected specifier-qualifier-list before ‘SHA_CTX’
    fast-import.c: In function ‘store_object’:
    fast-import.c:995: error: ‘SHA_CTX’ undeclared (first use in this function)
    fast-import.c:995: error: (Each undeclared identifier is reported only once
    fast-import.c:995: error: for each function it appears in.)
    fast-import.c:995: error: expected ‘;’ before ‘c’
    fast-import.c:1000: warning: implicit declaration of function ‘SHA1_Init’
    fast-import.c:1000: error: ‘c’ undeclared (first use in this function)
    fast-import.c:1001: warning: implicit declaration of function ‘SHA1_Update’
    fast-import.c:1003: warning: implicit declaration of function ‘SHA1_Final’
    fast-import.c: At top level:
    fast-import.c:1118: error: expected declaration specifiers or ‘…’ before ‘SHA_CTX’
    fast-import.c: In function ‘truncate_pack’:
    fast-import.c:1126: error: ‘struct sha1file’ has no member named ‘total’
    fast-import.c:1128: error: ‘struct sha1file’ has no member named ‘ctx’
    fast-import.c:1128: error: ‘ctx’ undeclared (first use in this function)
    fast-import.c: In function ‘stream_blob’:
    fast-import.c:1140: error: ‘SHA_CTX’ undeclared (first use in this function)
    fast-import.c:1140: error: expected ‘;’ before ‘c’
    fast-import.c:1141: error: expected ‘;’ before ‘pack_file_ctx’
    fast-import.c:1154: error: ‘pack_file_ctx’ undeclared (first use in this function)
    fast-import.c:1154: error: ‘struct sha1file’ has no member named ‘ctx’
    fast-import.c:1160: error: ‘c’ undeclared (first use in this function)
    fast-import.c:1220: error: too many arguments to function ‘truncate_pack’
    fast-import.c:1227: error: too many arguments to function ‘truncate_pack’
    make: *** [fast-import.o] Error 1
    rokon@rokon-laptop:~/git-1.7.1$

    • kibyegon says:

      You probably need to run the commands as root. Just type ‘sudo -s’ if you are running ubuntu which gives you root previlages. If you are running another distro just switch to root and you’ll be fine.

  16. George says:

    Hi Kibyegon. I followed the install instructions posted here, everything seemed to go as expected. My version is git version 1.7.3.1. But non of the manual pages are installed. For every git
    help COMMAND, I get nothing. Example : git$ git help add
    No manual entry for git-add
    See ‘man 7 undocumented’ for help when manual pages are not available. I installed this git release on my new ubuntu 10.04 desktop. I’ve missed something, but I’m not sure what.

  17. Fredrik Folkeryd says:

    Great blog, thanks. However, for me it actually seems to work just typing

    sudo apt-get install git

    This is actually the default explanation that comes up if you try to write ‘git’ at the command prompt in Meerkat.

  18. Akinyele Olubodun says:

    Thanks for this post. It is just the best. Simple and concise with no additional stuffs.

  19. ravi patel says:

    sir i got such result $ sudo aptitude install zlib1g-dev
    sudo: aptitude: command not found
    what should i do………

  20. Tom says:

    Hi Guys,

    Is there anyway we can install trac with git.

    Thx

  21. Steve says:

    You just made my day! Getting git up and running was the last obstacle to developing on my new Ubuntu laptop. Thank you. These instructions worked like a charm.

  22. zach says:

    exactly what I was looking for, and very easy to follow. Thanks!

  23. If you interested in running the latest stable release of git on Ubuntu 10.10 or Ubuntu 10.04, it is available in a Launchpad repository. For more instructions: http://blog.avirtualhome.com/git-packages-for-ubuntu/

  24. arthur says:

    For debian lenny add backports to your apt sources:

    nano /etc/apt/sources.list
    add: deb http://www.backports.org/debian lenny-backports main contrib
    apt-get update
    apt-get -t lenny-backports install git

    This will install the latest backport- the standard lenny package is 1.5, I needed 1.7

  25. Balamurali Krishna says:

    simple and easy.thanks

  26. [...] ffmpeg find, press enter to download by git 但是apt-get git各种不能, 于是参考: How to install Git on Ubuntu Lucid (10.04) 然后继续configure, 跑了一半说: Error: X11 support required for GUI compilation [...]

  27. Jake says:

    Thank you!

    now off to check out more of your blog.

  28. yuri says:

    Many thanks. It is the shortest and as such better guide to install Git. Up to date Git version is 1.7.5.1

  29. Mark says:

    Hi,
    I’m new at this Linux stuff so sorry for the simple question.
    Just tried installing GIT 1.7.5.1 from here:

    http://git-scm.com/download

    I typed “make” in a terminal shell, per the instructions, and I get an error about not finding zlib.h. where do it get zlib.h? It was not included in the download

    Thanks!

  30. Vishal says:

    Thanks a lot. It worked…. great.

  31. DaveK says:

    Thanks man, very easy to follow!

  32. lululatortue says:

    hi,

    I’ want download a driver :
    http://www.backtrack-linux.org/forums/hardware-compatibility-list/32897-broadcom-bcm43225-%5B14e4-4357%5D-not-working.html

    with git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git

    but when i write :
    me@me-laptop:~$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git
    Initialized empty Git repository in /home/lefrancois/staging-next-2.6/.git/
    fatal: The remote end hung up unexpectedly

    why unexpectedly, there is a peapol have found this problems?

  33. Sultan says:

    For Ubuntu 10.04 with Git version 1.7.6 run the following before step 5:

    $ sudo apt-get install zlib1g-dev libssl-dev

  34. Thanks, This is very useful and very easy way to install and use GIT :)

    Regards
    Harvin

  35. Kipp says:

    Nice and easy way, but if you that type of person who values security, you need to set up public and private keys first (of course using OpenSSH). check this out https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Generating+RSA+Keys
    Also if you are wanting a nice way to manage your git project, then have a look at the official Ubuntu git community page. https://help.ubuntu.com/community/Git . Best!

  36. chrisv says:

    thanks! this help out a lot. no issues with the install in ubuntu on a rackspace cloud server.

  37. Raji Srinivasan says:

    The steps are easy to follow. I just installed 1.7.6 version of git on Ubuntu (10.10).

    Thanks,
    Raji

  38. Nand says:

    I am using svn server, now want to switch to git server, there is any idea,how to do that?

    Nand

  39. A says:

    Great blog. Keep up the great work. It was just the answer I was looking for. I am working with StackOps and need git for a few new things.

    The first command in your blog worked fine.

    The second wget command tells me the error 503 the service is temporarily unavailable!

    Is there another place to get git from?

    A

  40. A says:

    Is there another place to get git from?

    A

  41. Franco says:

    Thank you dud. Had to install it manually and this article/post is whan I needed. And I like this kind of KISS articles (keep it small and simple).

  42. Joe says:

    the second wget is giving a 404. I’ve tried 1.7.1, 6, and 7 (current is 1.7.7) to no avail. Perhaps someone smarter than me knows an alternate? or can help me figure out what the right filename is?

  43. [...] here is a guide to install git… How to install Git on Ubuntu Lucid (10.04) Kibet's Brain Leaks [...]

  44. Kurian says:

    Gr8 One

  45. Hi @kibyegon, thanks for share…
    I use Ubuntu 10.04.4 LTS

    i’ve try typing :

    [soursecode lang="bash"]
    sudo aptitude build-dep git-core
    [/soursecode]

    in my command line, and I got :

    [soursecode lang="bash"]
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Reading extended state information
    Initializing package states… Done
    Writing extended state information… Done
    Unable to find the source package for “git-core”.
    Unable to find the source package for “git-core”.
    No packages will be installed, upgraded, or removed.
    0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0B of archives. After unpacking 0B will be used.
    E: You must put some ‘source’ URIs in your sources.list
    Writing extended state information… Done
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Reading extended state information
    Initializing package states… Done
    [/soursecode]

    than I try to use :

    [soursecode lang="bash"]
    sudo apt-get install git-core
    [/soursecode]

    it’s installed successfuly :D

  46. [...] make sudo make install ————————IF THIS DONT WORK INSTAll IT FROM THIS LINK : How to install Git on Ubuntu Lucid (10.04) Kibet's Brain Leaks IF THE COMMANDS ABOVE ISNT WORKING THEN TRY THIS: sudo apt-get install git-core sudo apt-get [...]

  47. Jude Pereira says:

    apt-get install git-core

  48. kibyegon says:

    Glad you like it. Thanks

  49. lantrix says:

    Seems like “soodaNoff” is a spam bot :-(
    PS: Is there not git package for 10.04 LTS?!

  50. kibyegon says:

    I guess askimet isn’t bullet proof. I never realized that there were more of the same comments from that bot only that they each link to a different site. Thanks for pointing this out.

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: