12

I am trying to install git, I used sudo apt-get install git command and it results:

E: Unable to locate package git

This question have been asked by many people but not a single answer has fixed my problem, I have tried:

sudo apt-get update
sudo apt-get upgrade

P.s: I am using ubuntu 14.04

  • On what mirror are you doing this? – Rinzwind Dec 6 '14 at 12:15
  • Local mirror, Pakistan, Is this what you asked? Or I am misunderstanding you? – mshahbazm Dec 6 '14 at 17:17
  • 2
    Pick any one you like. Maybe try one outside your country. – muru Dec 6 '14 at 17:26
  • 1
    Yes, I suggest trying a different mirror. – Seth Dec 6 '14 at 22:52
  • 1
    Many thanks all of you, I changed my mirror to US and My problem is solved. – mshahbazm Dec 7 '14 at 5:15
9

You can add manually repository

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E1DD270288B4E6030699E45FA1715D88E1DF1F24
sudo su -c "echo 'deb http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main' > /etc/apt/sources.list.d/git.list"

sudo apt-get update 
sudo apt-get install git
|improve this answer|||||
  • That won't work as sudo echo ... > /etc... try it yourself first. – Pilot6 Jul 23 '15 at 20:10
  • i did syntax mistake . now this working . – pl_rock Jul 24 '15 at 2:00
1

when you install Ubuntu package off-line usually in first of installation its cache doesn't get update so this error will occur and you have in your Ubuntu broken packages . for solution type in Terminal:

sudo apt-get install -f

it will repair broken packages and after it you can continue.

|improve this answer|||||
0

I got this error after spinning up a Debian instance on DigitalOcean. The fix was to

sudo apt update
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.