Skip to content

Instantly share code, notes, and snippets.

@zxhfighter
Created August 26, 2020 10:02
Show Gist options
  • Save zxhfighter/fba6d296a2c308706f646443c3a4d338 to your computer and use it in GitHub Desktop.
Save zxhfighter/fba6d296a2c308706f646443c3a4d338 to your computer and use it in GitHub Desktop.
compile git

手动编译安装 Git

下载

从这里下载源码包:https://mirrors.edge.kernel.org/pub/software/scm/git/,例如 git-2.19.0.tar.gz

上传

使用 rz -be 上传压缩包到 linux 机器。

安装

解压缩后,运行:

./configure  # 检测安装依赖
make         # 安装(非 root 账户需要 sudo)

构建生成的二进制文件在 bin-wrappers 目录。

bash-4.1$ ls bin-wrappers
git               git-shell           test-dump-fsmonitor        test-line-buffer    test-svn-fe
git-cvsserver     git-upload-archive  test-dump-untracked-cache  test-parse-options  test-tool
git-receive-pack  git-upload-pack     test-fake-ssh              test-pkt-line

软连接

我们来为这几个命令添加快捷方式,也就是符号链接(软连接),然后将该快捷方式放入 /usr/local/bin 目录,这个目录默认加入了 PATH 路径。

cd /usr/local/bin

ln -s yourpath/bin-wrappers/git git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment