3

I tried installing git by sudo apt-get install git. But I got error.

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

I also tried sudo apt-get install git-core and got this error

E: Unable to locate package git-core

since my current stack overflow reputation does not allow to post more than 2 link here. So, here is pastebin link for the output of grep '^[^#]' /etc/apt/sources.list.

After doing `sudo apt-get update' I got error:

Failed to fetch. Network is unreachable.

Here is complete output.

Edit: Output of sudo apt-get install git:

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
David Foerster
  • 36,264
  • 56
  • 94
  • 147

1 Answers1

1

First check if you can ping the gateway whatever it is in your case like

ping 192.168.0.1(your gateway in here)

if you revice and reply check if the route is corrent temporarily disable network-manager

sudo service network-manager stop

sudo ifconfig eth0(your adapter) 192.168.0.12/24(your ip) up
sudo route add default gw 192.168.0.1(your gateway)
sudo -i
echo "nameserver 208.67.222.222" > /etc/resolv.conf (opendns dont change these two)
echo "nameserver 208.67.220.220" >> /etc/resolv.conf

check route

route

then do

sudo apt-get update && sudo apt-get install git

if all works then change the settings in network-manager accordingly and if sudo apt-get update works but

sudo apt-get install git

dosent works then do it manually bu these steps

1) Install dpendencies

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

o ahead and get the version of git you want by visiting the git project's page on GitHub.

The version you see when you arrive at the project's page is the branch that is actively being committed to. If you want the latest stable release, you should go change the branch to the latest non-"rc" tag

2) Next, on the right side of the page, right-click the Download ZIP button and select the option similar to "Copy Link Address"

3)

wget https://github.com/git/git/archive/v1.9.2.zip -O git.zip

your version will vary

4)

unzip git.zip
cd git-*

make prefix=/usr/local all
sudo make prefix=/usr/local install

4) Now that you have git installed, if you want to upgrade to a later version, you can simply clone the repository and then build and install

git clone https://github.com/git/git.git

To find the URL to use for the clone operation, navigate to the branch or tag that you want on the project's GitHub page and then copy the clone URL on the right side

This will create a new directory within your current directory where you can rebuild the package and reinstall the newer version, just like you did above. This will overwrite your older version

5)

make prefix=/usr/local all
sudo make prefix=/usr/local install
  • FYI, I have also installed Ubuntu 14.04 in VMware player (Ubuntu 15.10 is installed in VMware Player) and everything is working fine there in Ubuntu 14.04. – Om Prakash Feb 28 '16 at 08:30
  • default route is default gateway?

    Output of sudo route add default gw 192.168.0.1(your gateway) is

    SIOCADDRT: Network is unreachable

    – Om Prakash Feb 28 '16 at 08:43
  • yes default route is default gateway change ip netmask and gateway to your needs but first stop network-manager temporarily then execute those commands with your ip netmask and gateway,and then if everything works restart the machine and apply those settings to network manager – Shantanu Bedajna Feb 28 '16 at 09:53