I'm trying to get Git working on an ancient Gentoo Linux box which I don't have root/elevated rights for. I figured I should be able to build and install Git locally in my ~/bin folder, whilst I can do this and it works I'm not able to get connect to remote HTTPS repositories (and this is essential, I can't use other Git remote protocols).

My process to build so far archived via various guides and tips found online: Add ~/bin to the start of my PATH.

Download and build CURL 8.4.0 - I assume Git needs CURL for the HTTP access part, also the Git build won't complete without being able to find curl/curl.h initially....

cd ~/src/curl-8.4.0
./configure --prefix=$HOME --with-openssl
make install

Curl is now in ~/bin and working - I can pull data from for HTTPS sources.

Further reading suggested I needed Expat - so I grabbed source for that too and built:

cd ~/src/expat-2.5.0
./configure --prefix=$HOME
make install

Finally the Git 2.42.1 build:

cd ~/src/git-2.42.1
make clean
make configure
./configure -prefix=$HOME -with-curl=~/bin CFLAGS="$CFLAGS -std=gnu99" --with-expat=~/bin
make install

Git is now installed and mostly working in ~/bin except for when I try to push my newly created local repo up to the server:

$ git push -u origin master
git: 'remote-https' is not a git command. See 'git --help'.

So I'm missing remote-https - but I can't work out why this is being missed: I assume it's silently failing somewhere rather than giving me an error about what it couldn't find during the build process?

Update I did some more troubleshooting on this and discovered the output of the configure script is showing Curl isn't being included in the Git build (which I think is required for this functionality to be available in Git): checking for curl_global_init in -lcurl... no

Then dug a bit deeper in the config.log file created by the configure script for Git. It seems the test for the Curl library is failing:

configure:5237: checking for curl_global_init in -lcurl
configure:5262: gcc -o conftest  -std=gnu99 -I~/include  -L~/lib  conftest.c -lcurl   >&5
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
configure:5262: $? = 1

This part I'm not sure about still - in ~/include is a Curl directory containing the headers from the Curl build, and in ~/lib are the libcurl librarys: libcurl.so and libcurl.so4. So why in the Git configure script failing to be able to see/use the libraries, have I not built them correctly maybe?

  • Does cloning a new repository over https:// work? What is the output of git remote -v? I am guessing you may have a misconfigured remote repository. Nov 11, 2023 at 2:12
  • Hi @GracefulRestart I tried cloning a publicly available repo and it fails immediately with the same error so I do think something is missing from my Git client build. For example: $ git clone https://github.com/git/git Cloning into 'git'... git: 'remote-https' is not a git command. See 'git --help'. Nov 11, 2023 at 6:38

1 Answer 1


It seems the problem was that the configure script for Git would attempt to find the Curl libraries and headers only in the default system locations, not the location my earlier local install had put them in. Manually adding these locations via the compiler and library flags options was the fix: CPPFLAGS="$CPPFLAGS -I/home/username/include" LDFLAGS="$LDFLAGS -L/home/username/lib" (weirdly using the ~ shorthand in the path for these options was ignored.)

More information on options that can be passed to the configure script for Git can be found by running ./configure --help, this is where I found the above flags and options.

The updated final working Git build steps where:

cd ~/src/git-2.42.1
make clean
make configure
./configure -prefix=$HOME --with-curl=$HOME CFLAGS="$CFLAGS -std=gnu99" CPPFLAGS="$CPPFLAGS -I/home/username/include" LDFLAGS="$LDFLAGS -L/home/username/lib"
make install

But one quandary remains: if I had to pass the locations of the header files and libraries in via this extra steps what is the option --with-curl=$HOME doing?

  • Good show, solving your own problem. The web is filled with this sort of issue, getting a software to build in a non-default environment. There should/could be a separate StackExchange for bad builds. Info very had to find, contradictory, unfinished, etc. Tnx for finishing yours. (I would migrate anything in your comment into the body of your answer and delete the comment, just more confusion (IMHO). Tnx!
    – shellter
    Nov 19, 2023 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .