10

I am attempting to install git on Debian 8.6 Jessie and have run into some dependency issues. What's odd is that I didn't have any issues the few times I recently installed Git in a VM while I was getting used to Linux.

apt-get install git

Results in:

The following packages have unmet dependencies:
  git : Depends: liberror-perl but is not installable
        Recommends: rsync but it is not installable
E: Unable to correct problems, you have held broken packages.

UPDATE

my sources.list

enter image description here

Seems to be an issue with my system. I can no longer properly install anything. I'm getting dependency issues installing things like Pulseaudio which I've previously installed successfully a few days ago.

  • Try sudo apt -f install or sudo aptitude -f. – phk Dec 26 '16 at 18:28
  • @phk 0 packages installed – DevonRyder Dec 26 '16 at 18:35
  • Run apt-get dist-upgrade && apt-get install git – GAD3R Dec 26 '16 at 18:40
  • Please edit here by adding the output of cat /etc/apt/sources.list – GAD3R Dec 26 '16 at 18:45
  • @GAD3R I can't seem to copy from the terminal or nano – DevonRyder Dec 26 '16 at 19:06
16

You should edit your sources.list , by adding the following line:

deb http://ftp.ca.debian.org/debian/ jessie main contrib

Then upgrade your package and install git:

apt-get update && apt-get upgrade && apt-get dist-upgrade
apt-get -f install
apt-get install git

Edit

the following package git , liberror-perl and [rsync]3 can be downloaded from the main repo , because you don't have the main repo on your sources.list you cannot install git and its dependencies .

Your sources.list should be (with non-free packages):

deb http://ftp.ca.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.ca.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

deb http://ftp.ca.debian.org/debian/ jessie-updates main contrib non-free
deb-src http://ftp.ca.debian.org/debian/ jessie-updates main contrib non-free

deb http://ftp.ca.debian.org/debian/ jessie-backports main contrib non-free

On debian Stretch your /etc/apt/sources.list should be (at least):

deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/ stretch/updates main 
deb http://deb.debian.org/debian/ stretch-updates main
  • I already have that in the image, no? Also, it seems to be a new issue with my system. I get a similar unmet dependencies message when tryin to install anything now. – DevonRyder Dec 26 '16 at 22:49
  • 1
    Okay, it's worked now, thanks. What's the difference with the deb source at the bottom VS at the top? Do you just prefer to add backports separate? Also, is it normally advised to use non-free and contrib with security updates? – DevonRyder Dec 27 '16 at 14:47
  • 1
    @GAD3R for debian 9 we should also add the following link that you wrote , to our sources list or another link ?? – Parsa Jul 17 '18 at 5:09
  • 1
    @Parsa I have update my answer. – GAD3R Jul 17 '18 at 9:53
  • 1
    @GAD3R. Thank you for the answer. I understand your point. However, when I read this answer I was using Ubuntu and I had the exaclty same problem in Ubuntu 18.04 ... :/ Unfortunately... – WitnessTruth Feb 5 at 19:10
2

Try apt-get update && apt-get install git-core.

I found it in here.

  • 1
    The git-core package is just a transitional package which unique function is to pull the git package. – Bigon Dec 26 '16 at 18:33
  • @sidahmed I too saw this link earlier. However, I get the error git-core : Depends: git (> 1:1.7.0.2) but is not going to be installed. – DevonRyder Dec 26 '16 at 18:33
  • I know that this may be obvious, but did you use apt-get update ?? – Sidahmed Dec 26 '16 at 18:38
  • @Sidahmed Indeed. – DevonRyder Dec 26 '16 at 18:39
  • okay, clean all the cache with this two commands sudo apt-get clean and sudo rm -r /var/lib/apt/lists/*. Then reuse the command in the answer. – Sidahmed Dec 26 '16 at 18:40
0

I fixed by only keeping in the sources.list these urls:

nano /etc/apt/sources.list

deb http://ftp.debian.org/debian/ stable main contrib non-free
deb http://ftp.de.debian.org/debian jessie main

Then I run:

# ensure that the shared libraries are properly registered (also fixes some GCC/G++ errors)
sudo ldconfig

#check your package cache
sudo apt-get check

#update your package list
sudo apt-get update

#ensure package downloads were properly completed when the system last updated
sudo apt-get upgrade --fix-missing

#try to upgrade the system (sometimes an updated package version fixes the issue)
sudo apt-get upgrade
sudo apt-get dist-upgrade

#try to reconfigure all applications that failed to install
sudo dpkg --configure -a

#try to fix broken packages
sudo apt-get install -f

Finally:

sudo apt-get install git
0

I just ran sudo apt update followed by sudo apt upgrade. After that, sudo apt install git worked fine.

0

There are several materials which I would like to solve problems in Debian Linux 10.

  1. Linux (by terminal):
    uname -a
    uname -mrs
  2. You should download suitable version of the git (here)
  3. Try this command by terminal:
    sudo dpkg -i git_2.20.1-2_amd64.deb
  4. If you faced the issues dependence problems (more):
    sudo dpkg --configure -a
    sudo apt-get -f install
    sudo apt install git_2.20.1-2_amd64.deb --reinstall
  5. You should configure:
    cd /etc/apt/
    nano sources.list
    (try open all_ )
    deb http://ftp.debian.org/debian/ stable main contrib non-free
    deb http://ftp.de.debian.org/debian jessie main

  6. Just follow this structure:
    apt-update && apt search ^git

  7. Next also following several command by the terminal:

    --> Make sure that the shared libraries are properly registered (also fixes some GCC/G++ errors)
    sudo ldconfig

    --> check your package cache
    sudo apt-get check

    --> You should update your package list here
    sudo apt-get update

    --> ensure package downloads were properly completed when the system last updated
    sudo apt-get upgrade --fix-missing

    --> try to upgrade the system (sometimes an updated package version fixes the issue)
    sudo apt-get upgrade
    sudo apt-get dist-upgrade

    --> Strive to reconfigure all applications that failed to install

    sudo dpkg --configure -a

    --> try to fix broken packages
    sudo apt-get install -f

  8. Final Step is just giving processing:
    sudo apt-get install git.

Summary:
git is already the newest version (1:2.20.1-2).

You are successfully proceeding all steps.

  • Can you explain what the steps do? – RalfFriedl Oct 8 at 5:16
  • RalfFriedl you can use above explanation content. What is exactly issues in your system. – Hamdambek Oct 8 at 8:22

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.