OS X:便携式Git(又名安装多个Git版本) [英] OS X: portable Git (aka install multiple Git versions)
问题描述
我目前正在尝试在OS X上安装多个Git版本用于测试目的。从 git-scm.com 下载OS X安装程序捆绑软件(安装到 / usr / local / git
),我将它移动到不同的位置,例如〜/ git-1.7.11.1
或〜/ git-1.8.1
。不幸的是,Git不喜欢这样的举动:
$〜/ git-1.7.11.1 / bin / git fetch
致命:无法找到'https'的远程助手
甚至更糟:
$〜/ git-1.7.11.1 / bin / git pull
git:'pull'不是git命令。参见'git --help'。
你的意思是?
shell
当我设置路径时,它也不起作用:
$ export PATH =〜/ git-1.7.11.1 / bin:$ PATH
$其中git
/ Users / xxx / git-1.7.11.1 / bin / git
$ git pull
git:'pull'不是git命令。参见'git --help'。
你的意思是?
shell
我还需要在Git捆绑包中进行更改他们是否可移植(又名在每个位置运行)?
git-scm安装程序似乎将所有内容都安装在/ usr / local / git(通过查看git-scm下载中的uninstall.sh文件推断出来)。因此,重命名git目录应该不成问题。你需要做的是增加你的路径:
PATH = $ PATH:/usr/local/git-1.7。 11.1 / bin
使
请注意,如果您尝试从同一个shell中调用多个git版本,则此方法不起作用;所有版本都会从PATH中的第一个目录获得帮助程序。
您还需要设置环境变量GIT_EXEC_PATH。使用
git --exec-path
以了解它目前的状况,然后使用新的:
git --exec -path =< ... git-1.7.11.1 /...>
或者定义GIT_EXEC_PATH。
另外,它的构建路径似乎构建在 git
可执行文件中,这可能表明 git
期望其支持文件在默认位置。
ebg @ ebg(147)$ strings git | grep usr
/ usr / local / git
/ usr / local / bin:/ usr / bin:/ bin
ebg @ ebg(148)$ strings / usr / bin / git | grep usr
/Applications/Xcode.app/Contents/Developer/usr
/ usr / local / bin:/ usr / bin:/ bin
因此,请使用GIT_EXEC_PATH。有关详情,请参见 GIT手册页。
I'm currently trying to install multiple Git versions on OS X for testing purposes. After downloading the OS X installer bundle from git-scm.com (which installs to /usr/local/git
), I move it to a different location, e.g. ~/git-1.7.11.1
or ~/git-1.8.1
. Unfortunately, Git does not like this move:
$ ~/git-1.7.11.1/bin/git fetch
fatal: Unable to find remote helper for 'https'
or even worse:
$ ~/git-1.7.11.1/bin/git pull
git: 'pull' is not a git command. See 'git --help'.
Did you mean this?
shell
When I set the path, it also does not work:
$ export PATH=~/git-1.7.11.1/bin:$PATH
$ which git
/Users/xxx/git-1.7.11.1/bin/git
$ git pull
git: 'pull' is not a git command. See 'git --help'.
Did you mean this?
shell
Is there anything I need to change in the Git bundles, too, to make them portable (aka running at each location)?
The git-scm installer does appear to install everything in /usr/local/git (inferred by looking at the uninstall.sh file in the git-scm download). Therefore, renaming the git directory should not be a problem. What you need to do is augment your path as such:
PATH=$PATH:/usr/local/git-1.7.11.1/bin
so that git
and all its helper programs can be found.
Note that this approach won't work if you try to call multiple git versions from the same shell; all the versions will get their helper programs from the first directory in PATH.
[edit] You will also need to set the environment variable GIT_EXEC_PATH. Use
git --exec-path
to learn what it currently is and then use a new one with:
git --exec-path=<...git-1.7.11.1/...>
or by defining GIT_EXEC_PATH.
Also it appears that the build path is built into the git
executable which may indicate that git
expects its supporting files in a default location.
ebg@ebg(147)$ strings git | grep usr
/usr/local/git
/usr/local/bin:/usr/bin:/bin
ebg@ebg(148)$ strings /usr/bin/git | grep usr
/Applications/Xcode.app/Contents/Developer/usr
/usr/local/bin:/usr/bin:/bin
So, use GIT_EXEC_PATH. See the GIT Man Page for more info.
这篇关于OS X:便携式Git(又名安装多个Git版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!