Niya Simon C
Niya Simon C

Reputation: 299

git installation error missing installation candidate

I tried installing git on Ubuntu 12.10 using the command sudo apt-get install git. But I am getting error message like this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package git is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'git' has no installation candidate

What am I supposed to do further?

Upvotes: 13

Views: 60512

Answers (6)

I got this error when unchecked all options in "System Settings / Software & Updates" while disabling auto-update. Checking back all checkboxes in "Ubuntu Software" and "Other Software" fixed the problem.

Upvotes: 0

Bus42
Bus42

Reputation: 152

I had this problem as well. In Software and Updates, Canonical-supported free and open-source software (main) was unchecked and under the Installable from CD-ROM/DVD section, the box was checked causing apt to look for the package on a non-existent optical drive.

Upvotes: 2

mohammad kasiri
mohammad kasiri

Reputation: 159

First run this command to update

sudo apt update 

Then run this

sudo apt-get install git

Upvotes: 13

andgursky
andgursky

Reputation: 352

Try running below commands.

sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update

Upvotes: 16

Michael Adam
Michael Adam

Reputation: 761

The git package should be installable. In principle if something like this occurs, you should verify the following.

  • Make sure that the contents of your /etc/apt/sources.list file is sane. It should contain something like this:

    deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
    
  • Make sure you have run apt-get update before trying to install git.

Note that the above sources.list is for precise (12.04). 12.10 is called quantal. But note that 12.10 is not supported any more (EOL was May 2014 - see here). So the solution to your problem might be that the package sources for 12.10 don't exist any more on the server, so the message is in fact correct: on the server there simply is no candidate any more...

The solution would then be to upgrade to at least the next LTS version (14.04).

Upvotes: 4

Marco M. von Hagen
Marco M. von Hagen

Reputation: 219

I found a nice tutorial about git on ubuntu 12 here.

It mainly mentioned the dependencies prior to install:

sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

and to use this for the git installation: sudo apt-get install git-core sudo apt-get update

and further more it says: Once they are installed, you can download the latest version of Git from the google code page.

wget https://git-core.googlecode.com/files/git-1.8.1.2.tar.gz

After it downloads, untar the file and switch into that directory:

tar -zxf git-1.8.1.2.tar.gz

cd git-1.8.1.2

If you want to do a global install, install it once as yourself and once as root, using the sudo prefix:

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://git.kernel.org/pub/scm/git/git.git

Go and check the tutorial and leave her a comment ;-)

Upvotes: 0

Related Questions