4

git ダウンロード ページhttp://git-scm.com/downloads [他の多くのチュートリアル ページの中でも] を見ると、git 自体を更新できることがわかります。現在、私のデスクトップにはgit 1.7.9.5があり、最新のものは1.8.1.3です

Ubuntu 12.04 LTS を実行しており、これらのコマンドをホーム ディレクトリ [~/] で実行しています。

次のコマンドを実行したところ、次の出力が得られました。

~$ git version
git version 1.7.9.5
~$ git clone https://github.com/git/git.git
Cloning into 'git'...
remote: Counting objects: 149633, done.
remote: Compressing objects: 100% (49646/49646), done.
remote: Total 149633 (delta 109386), reused 136311 (delta 98050)
Receiving objects: 100% (149633/149633), 34.92 MiB | 864 KiB/s, done.
Resolving deltas: 100% (109386/109386), done.
~$ git version
git version 1.7.9.5

最終結果は、git のバージョンが同じということです。唯一の違いは、ホーム ディレクトリに git という名前のフォルダーがあり、ソフトウェアを構成するファイルであるとしか思えないことです。明らかにいくつかの手順が欠けています。Google と YouTube を検索して、ウォークスルーや、「git 経由で git を取得できます。このコマンドを入力するだけです」以外の詳細な説明を見つけました。

この質問が以前に回答されていたら、申し訳ありません。不足している手順を見つけることができる場所を誰かが知っている場合は、リンク/説明をいただければ幸いです。

また、これが自分では理解できないほど単純なことのように思えることもお詫びします。

そして最後に、答えを見つけるのを手伝ってくれたすべての人に心から感謝しています!

編集 3.18.13: 今週、新しいラップトップを入手したときに、これをもう一度行う必要がありました。皆さんのおかげで走っgit --versionて帰ることができましたgit version 1.8.2

git book の指示に従いました。iltempoに感謝します。

次に、コンパイルしてインストールします。

$ tar -zxf git-1.7.2.2.tar.gz
$ cd git-1.7.2.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install

ただし、github から zip ファイルを取得したので、代わりにそれを解凍しました。他の手順を実行しませんでした...

これは、ソースから何かを構築するのが初めて/だったので、以下で言及されている用語のいくつかが何を意味するのかよくわかりません:

'ensure/usr/local/binがパスの先頭に追加されます' - iltempo

ディレクトリを my path に追加する方法はわかりましたが、これの意味や、これを行うと何が起こっているのかわかりません。

4

2 に答える 2

7

"Updating git with git" means updating the git repo sources with a git pull, once you have cloned https://github.com/git/git.

You would still need to build git from said sources, and install it before seeing a difference in the git --version command.

See the "INSTALL" file:

$ make prefix=/usr/local all doc info ;# as yourself
# make prefix=/usr/local install install-doc install-html install-info ;# as root

Since you are installing that updated git in /usr/local/bin, make sure that path comes first in your own $PATH environment variable (that you can set in your .profile)


The other way would be to use apt-install (see "How to upgrade Git on Ubuntu Hardy?"), but when I look for the package git-core, the Precise package only goes up to git_1.7.9.5.
That is why building from sources can be an alternative to waiting for git-core to be updated.

于 2013-02-28T09:13:03.680 に答える
1

git uses the standard GNU autotools setup, see the INSTALL file in the sources. Then you can do the standard ./configure; make; make install dance.

For my personal use I set it up with prefix=$HOME, and have an alias git=~/bin/git in my .bashrc, so PATH is not a issue.

于 2013-03-01T02:10:07.513 に答える