设置一个定制的Git安装 [英] Setting up a custom Git installation

查看:91
本文介绍了设置一个定制的Git安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找将Git安装在与默认 usr / local / git / bin / git 目录不同的自定义位置,该安装目录来自 http://git-scm.com/ 网站安装到。例如,我试图将 usr / local / git 的内容复制到 / Users / braitsch / my-git 并将我的路径变量更新为 / Users / braitsch / my-git / bin ,现在Git的不愉快的说法它找不到一些命令,如 git -stash



我也尝试设置 ./ git exec-path = / Users / braitsch / my-git / libexec / git-core 但这似乎没有采取。



所以我的问题是你们如何设置Git的自定义安装而不使用软件包经理或预建安装人员?我很想找到一个我可以在Mac和Mac上轻松使用的场景。视窗。提前感谢。
$ b

- 更新 -



看起来像Git存储以及可能的其他命令)如果通过软件包安装程序将安装在 usr / local / git 上的目录移动到另一个位置,将会失败。有没有人有任何建议如何解决这个问题?我试图从自定义位置运行Git,但似乎无法通过 http:// git- scm.com 网站?

解决方案

适用于我的很好(包括 git )是克隆git仓库,例如与:

  cd 
git clone git://github.com/gitster/git.git
cd git
make

(我以前使用 sudo apt-get build-dep git ,它可以在最近的基于Debian的发行版上运行 - 否则,如果你遇到了构建错误,你只需要安装git的构建依赖关系使用。)



然后你可以调用这个git:

  $ export GIT_EXEC_PATH =〜/ git / 
$〜/ git / git --version
git version 1.7.7.rc0.72.g4b5ea

...或使用〜/ git / git --exec-path = / home / mark / git 而不是环境变量。



您可以将构建的源代码树移动到任何位置,并且它仍然有效,例如:

  $ mv〜/ git〜/ tmp / 
$ export GIT_EXEC_PATH =〜/ tmp / git /
$〜/ tmp / git / git --version
git version 1.7.7.rc0.72.g4b5ea


I'm looking to install Git in a custom location different from the default usr/local/git/bin/git directory that the package installer from the http://git-scm.com/ website installs to.

For example, I just tried copying the contents of usr/local/git to /Users/braitsch/my-git and updating my path variable to /Users/braitsch/my-git/bin and now Git's unhappy saying that it can't find some of its commands such as git -stash.

I also just tried setting ./git exec-path=/Users/braitsch/my-git/libexec/git-core but that doesn't seem to be taking.

So my question for you guys is how would you setup a custom install of Git without the use of package managers or pre-built installers? I'd love to find a scenario that I could easily use on both Mac & Windows. Thanks in advance.

-Update-

It looks like Git stash (and possibly other commands) will fail if you move the directory that gets installed at usr/local/git via the package installer to another location. Does anyone have any suggestions on how to get around this? I'm trying to run Git from a custom location but it appears this is not possible via the builds on the http://git-scm.com site?

解决方案

What works fine for me (including git stash) is to clone the git repository, e.g. with:

cd
git clone git://github.com/gitster/git.git
cd git
make

(I had previously installed the build dependencies with sudo apt-get build-dep git, which will work on a recent Debian-based distribution - otherwise if you get a build error you'll just have to install git's build dependencies with whatever mechanism you normally use.)

Then you can call this git with:

$ export GIT_EXEC_PATH=~/git/
$ ~/git/git --version
git version 1.7.7.rc0.72.g4b5ea

... or using ~/git/git --exec-path=/home/mark/git instead of the environment variable.

You can move the built source tree to anywhere, and it still works, e.g.:

$ mv ~/git ~/tmp/
$ export GIT_EXEC_PATH=~/tmp/git/
$ ~/tmp/git/git --version
git version 1.7.7.rc0.72.g4b5ea

这篇关于设置一个定制的Git安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆