OS X: Portable Git (also install multiple versions of Git)

I am currently trying to install several versions of Git on OS X for testing. After downloading the OS X installation package from git-scm.com (which installs on /usr/local/git), I move it to another location, for example. ~/git-1.7.11.1or ~/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 something I need to change in Git packages to make them portable (e.g. working in every place)?

+1
source share
2 answers

git -scm, , /usr/local/ git ( uninstall.sh git -scm). git . , :

PATH=$PATH:/usr/local/git-1.7.11.1/bin

git .

, , git ; PATH.

[edit] 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 Man Page.

+3

GIT_EXEC_PATH:

$ ~/git-1.7.11.1/bin/git pull
git: 'pull' is not a git command. See 'git --help'.

Did you mean this?
        shell
$ export GIT_EXEC_PATH=~/git-1.7.11.1/libexec/git-core/
$ ~/git-1.7.11.1/bin/git pull
Password for 'https://xxx': 
+2

All Articles