Can't install git related packages on Ubuntu 18.04 due to unmet dependency

When trying to install gitk via sudo apt install gitk i get the output

...
The following packages have unmet dependencies:
 gitk : Depends: git (< 1:2.17.1-.)
E: Unable to correct problems, you have held broken packages.

i have tried installing an older version of git with the command

sudo apt install git=1:2.17.0-1ubuntu1

which produces the output

...
The following packages have unmet dependencies:
 git : Depends: git-man (< 1:2.17.0-.) but 1:2.18.0-0ppa1~ubuntu16.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

I don't understand why it says that 2.18 is to be installed when i specified an older version to be installed in the command. My OS is Ubuntu 18.04 and my git is currently version 2.18.0. How can I solve this problem?


You are using a PPA that also provides git. This is resulting in the version confusion that you're seeing that prevents installations.

Per your comment, you removed /etc/apt/sources.list.d/git-core-ubuntu-ppa-xenial.list and then ran sudo add-apt-repository ppa:git-core/ppa. Once that happened, your apt-get update and apt-get upgrade worked.