简体   繁体   English

在mac osx lion上安装另一个版本的Git

[英]Install another version of Git on mac osx lion

On my mac, first I installed the xcode which is installed with git already, however the git is old version. 在我的Mac上,首先我安装了已经安装了git的xcode,但是git是旧版本。 When I run which git, the result is: "/usr/bin/git". 当我运行哪个git时,结果是:“/ usr / bin / git”。

I want to install latest version of git, and use this as the default git. 我想安装最新版本的git,并将其用作默认git。 I tried the way on this site: http://git-scm.com/book/en/Getting-Started-Installing-Git 我试过这个网站的方式: http//git-scm.com/book/en/Getting-Started-Installing-Git

First, i update to the xcode version of git, it doesn't work. 首先,我更新到git的xcode版本,它不起作用。

Then, I tried to download new version of git and install it in the usr/local/git directory, when I run the command "make prefix=/usr/local all", I got some problem: 然后,我尝试下载新版本的git并将其安装在usr / local / git目录中,当我运行命令“make prefix = / usr / local all”时,我遇到了一些问题:

ld: library not found for -lintl
collect2: ld returned 1 exit status
make: *** [git-credential-store] Error 1

Anybody knows how to fix this problem? 有谁知道如何解决这个问题?

Also, I tried to download the dmg file and it is installed successfully, but when I run the command git --version, it is still the old version. 此外,我尝试下载dmg文件并成功安装,但是当我运行命令git --version时,它仍然是旧版本。

Thanks. 谢谢。

Edit ~/.profile so that the path to the new git directory is before the path to the old git directory so it always find it (and associated files) first. 编辑〜/ .profile,以便新git目录的路径位于旧git目录的路径之前,因此它总是首先找到它(和相关文件)。 Without this, you will find that the new git will look for supporting files using the system path and will get the ones for the old git, causing a problem. 如果没有这个,你会发现新的git将使用系统路径寻找支持文件,并将获得旧git的文件,从而导致问题。

Add this line to .profile 将此行添加到.profile

export PATH=/path/to/new/git:$PATH

Then close and reopen the terminal to reload it and do echo $PATH to check. 然后关闭并重新打开终端重新加载它并回显$ PATH进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM