Unmet dependencies while installing Git on Debian

38,582

Solution 1

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

Solution 2

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

I found it in here.

Solution 3

sudo apt-get purge mongodb mongodb-server mongodb-server-core mongodb-clients
sudo apt-get purge mongodb-org
sudo apt-get autoremove

Use this code. It is working.

enter image description here

Share:
38,582

Related videos on Youtube

DevonRyder
Author by

DevonRyder

Updated on September 18, 2022

Comments

  • DevonRyder
    DevonRyder over 1 year

    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.

    • phk
      phk over 7 years
      Try sudo apt -f install or sudo aptitude -f.
    • DevonRyder
      DevonRyder over 7 years
      @phk 0 packages installed
    • GAD3R
      GAD3R over 7 years
      Run apt-get dist-upgrade && apt-get install git
    • GAD3R
      GAD3R over 7 years
      Please edit here by adding the output of cat /etc/apt/sources.list
    • DevonRyder
      DevonRyder over 7 years
      @GAD3R Okay, sorry, I've added the scrot now.
  • Bigon
    Bigon over 7 years
    The git-core package is just a transitional package which unique function is to pull the git package.
  • DevonRyder
    DevonRyder over 7 years
    @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.
  • Sidahmed
    Sidahmed over 7 years
    I know that this may be obvious, but did you use apt-get update ??
  • DevonRyder
    DevonRyder over 7 years
    @Sidahmed Indeed.
  • Sidahmed
    Sidahmed over 7 years
    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.
  • DevonRyder
    DevonRyder over 7 years
    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.
  • GAD3R
    GAD3R over 7 years
    No ! You have the deb-src on your sources.list
  • DevonRyder
    DevonRyder over 7 years
    Alright, I'll take a look shortly. Why would this cause all these dependency issues while installing any packages though when it worked before?
  • DevonRyder
    DevonRyder over 7 years
    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?
  • GAD3R
    GAD3R over 7 years
    the deb-src is used to download the source code of a program , the deb is used to install the program. You can move backports source to the top , it is not a problem . Yes you should use the security update with non-free sources
  • Parsa
    Parsa almost 6 years
    @GAD3R for debian 9 we should also add the following link that you wrote , to our sources list or another link ??
  • GAD3R
    GAD3R almost 6 years
    @Parsa I have update my answer.
  • WitnessTruth
    WitnessTruth about 5 years
    This is bad for Ubuntu. A simple git installation we have to follow all these steps to simply install a git.
  • GAD3R
    GAD3R about 5 years
    @WitnessTruth This answer is valid for only for Debian. On Ubuntu you should have main , update and security components enabled on your sources.list. You can ask a question to if you have a problem with git installation to get a detailed answer , and you are welcome.
  • WitnessTruth
    WitnessTruth about 5 years
    @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...
  • GAD3R
    GAD3R about 5 years
    @WitnessTruth There is a sample sources.list on AskUbuntu , exclude the bionic-backports, just you need the first 3 lines, Then update and install git. Make sure to have only the 3 lines ( that's why it is hard to answer in a comment without knowing the current sources configuration. Because a duplicate url may cause a problem)
  • RalfFriedl
    RalfFriedl over 4 years
    Can you explain what the steps do?
  • Hamdambek
    Hamdambek over 4 years
    RalfFriedl you can use above explanation content. What is exactly issues in your system.
  • Jeremy Boden
    Jeremy Boden over 2 years
    So the solution is to install some Ubuntu stuff on top of Debian? Good luck with that.