How to install git in Ubuntu

Using ” sudo apt-get install git ” this command to install git.

Note: but during the installation, an error occurred.

The error code:

$ sudo apt-get install git
Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run ‘apt-get -f install’ to correct these:
The following packages have unmet dependencies:
git : Depends: liberror-perl but it is not going to be installed
Depends: git-man (> 1:2.7.4) but it is not going to be installed
Depends: git-man (< 1:2.7.4-.) but it is not going to be installed
libsmbclient : Depends: samba-libs (= 2:4.3.11+dfsg-0ubuntu0.16.04.12) but 2:4.3.11+dfsg-0ubuntu0.16.04.13 is to be installed
samba-libs : Depends: libwbclient0 (= 2:4.3.11+dfsg-0ubuntu0.16.04.13) but 2:4.3.11+dfsg-0ubuntu0.16.04.12 is to be installed
E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).

Then I tried to use ” sudo apt-get -f install” this command.

$sudo apt-get -f install
[sudo] password for xxx:
E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

Don’t worried. We can try to remove these files.

$ sudo rm /var/cache/apt/archives/lock

$ sudo rm /var/lib/dpkg/lock

Now we try to use ” sudo apt-get -f install ” to install git again.

Then I used ” sudo apt install git ” this command to install git.

Oh, Yes, It works.

You can try to use git to make sure it has been installed correctly.

Like this:

git clone https://pdos.csail.mit.edu/6.828/2017/jos.git lab

Get a code base from MIT.

Have fun.


Share this article to your social media
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments