Skip to content

Compile GIT

Tested on version 2.42.0

You can compile git from source to get the latest version. But if you want to have access to remote-curl command, you need to compile it with curl. Then set CURL_CONFIG to the curl binary curl-config, like this:

bash
export CURL_CONFIG=<GITHUB_PULL_DIR>/curl/build/bin/curl-config

With this, when you will run ./configure of git source, it will use the curl-config binary to get the curl configuration.

Get git source

Clone git or download source code in a specific directory.

bash
git clone https://github.com/git/git.git

Tested on centos7

Prefix is the directory where you want to install git.

use --with-gitconfig=~/.gitconfig because by default it will use the prefix directory to find the gitconfig file, and it will fail if you want to share the git binary with other users.

bash
cd git
make configure
./configure --prefix=<GITHUB_PULL_DIR>/git/build --with-curl=<GITHUB_PULL_DIR>/curl/build --with-gitconfig=~/.gitconfig
make
make install

Then you can find git in <GITHUB_PULL_DIR>/git/build/bin/git and you can use it directly, put theses binaries in a rez package, etc.