问题描述
在我的Mac上,首先我安装了已经与git一起安装的xcode,但是git是旧版本.当我运行哪个git时,结果是:"/usr/bin/git".
On my mac, first I installed the xcode which is installed with git already, however the git is old version. When I run which git, the result is: "/usr/bin/git".
我想安装最新版本的git,并将其用作默认git.我在以下网站上尝试过这种方式: http://git-scm.com /book/zh-CN/Getting-Started-Installing-Git
I want to install latest version of git, and use this as the default git. I tried the way on this site: http://git-scm.com/book/en/Getting-Started-Installing-Git
首先,我更新到git的xcode版本,它不起作用.
First, i update to the xcode version of git, it doesn't work.
然后,我尝试下载新版本的git并将其安装在usr/local/git目录中,当我运行命令"make prefix =/usr/local all"时,出现了一些问题:
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:
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?
此外,我尝试下载dmg文件并成功安装,但是当我运行命令git --version时,它仍然是旧版本.
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.
谢谢.
推荐答案
编辑〜/.profile,以便新git目录的路径位于旧git目录的路径之前,因此始终可以找到它(及其关联文件)第一的.否则,您会发现新的git将使用系统路径查找支持文件,并将获取旧git的文件,从而导致问题.
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. 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.
将此行添加到.profile
Add this line to .profile
export PATH=/path/to/new/git:$PATH
然后关闭并重新打开终端以重新加载终端,并回显$ PATH以进行检查.
Then close and reopen the terminal to reload it and do echo $PATH to check.
这篇关于在Mac OS X Lion上安装另一个版本的Git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!