Tingkatkan versi Git di Ubuntu 14.04


49

Bisakah tolong beri tahu saya apa yang salah dengan ini?

saya berlari

$ sudo apt-get purge git; sudo apt-get autoremove; sudo apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  git-man liberror-perl
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  git* git-core*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 21.0 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 81533 files and directories currently installed.)
Removing git-core (1:1.9.1-1ubuntu0.1) ...
Removing git (1:2.2.2-0ppa1~ubuntu10.04.1) ...
Purging configuration files for git (1:2.2.2-0ppa1~ubuntu10.04.1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  git-man liberror-perl
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 1,831 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 80929 files and directories currently installed.)
Removing git-man (1:2.2.2-0ppa1~ubuntu10.04.1) ...
Removing liberror-perl (0.17-1.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  git-man liberror-perl
Suggested packages:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk
  gitweb git-arch git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11.0 MB of archives.
After this operation, 22.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package liberror-perl.
(Reading database ... 80751 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.2.2-0ppa1~ubuntu10.04.1_all.deb ...
Unpacking git-man (1:2.2.2-0ppa1~ubuntu10.04.1) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.2.2-0ppa1~ubuntu10.04.1_i386.deb ...
Unpacking git (1:2.2.2-0ppa1~ubuntu10.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:2.2.2-0ppa1~ubuntu10.04.1) ...
Setting up git (1:2.2.2-0ppa1~ubuntu10.04.1) ...

Setelah itu $ git --versionmuncul:

git version 1.8.2.1

Sepertinya git 2.x telah diinstal tetapi saya dapat terus mendapatkan versi yang lama.


Pembaruan:


Harap edit posting Anda dan tambahkan output dari dpkg -L gitdan which git.
muru

Jawaban:


126

Anda perlu menambahkan repositori Git Maintainers untuk mendapatkan versi Git terbaru.

Silakan jalankan perintah ini secara berurutan:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Kemudian, periksa versi Git yang diinstal:

git --version

Tidak selalu diperlukan untuk menghapus Git yang ada sebelum memutakhirkannya, tetapi jika Anda mengalami masalah, lakukan yang berikut dan ulangi langkah-langkah yang disebutkan di atas:

sudo apt-get remove git

6
Saya berhasil memutakhirkan tanpa menghapus git terlebih dahulu (saya tidak menjalankan sudo apt-get remove git)
7ochem

Saya pikir tidak perlu menghapus git. Saya
memutakhirkan

1
@ glarrain Saya menulis baris itu sebagai tindakan pencegahan terhadap segala jenis korupsi data.
mertyildiran

1
saya punya vmware virtual desktop perusahaan yang menjalankan ubuntu 14 dan ia memberitahu saya - tidak dapat menambahkan ppa, silakan periksa format ....
Kalpesh Soni

3

Anda memiliki salinan git kedua yang terpasang /usr/local/binyang digunakan sebagai ganti sistem yang dipasang git.

Tanpa mengetahui bagaimana git lain telah diinstal, saya akan mengatakan bahwa Anda perlu menghapus biner git lainnya secara manual /usr/local/bin.

Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.