13

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.

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

7 Answers 7

18

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
11
  • 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, 2016 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, 2016 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, 2018 at 5:09
  • 1
    @Parsa I have update my answer.
    – GAD3R
    Jul 17, 2018 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... Feb 5, 2019 at 19:10
2

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

I found it in here.

5
  • 1
    The git-core package is just a transitional package which unique function is to pull the git package.
    – Bigon
    Dec 26, 2016 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, 2016 at 18:33
  • I know that this may be obvious, but did you use apt-get update ??
    – Sidahmed
    Dec 26, 2016 at 18:38
  • @Sidahmed Indeed.
    – DevonRyder
    Dec 26, 2016 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, 2016 at 18:40
1
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

1
  • So the solution is to install some Ubuntu stuff on top of Debian? Good luck with that. Aug 16, 2021 at 13:59
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.

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

I am new to linux environment so i was facing this issue and unable to find solution for myself. After reading from resources, this helped in my case:

  1. Commented everything else in sources.list
  2. Added just "deb http://archive.ubuntu.com/ubuntu 1 bionic main" line.

how to edit sources.list: click here

And the discussion i found usefull was Here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .