Installing Git with non-root user account
You can download the git source and do ./configure --prefix=/home/user/myroot && make && make install
to install git to your home directory provided you have the build tools. If you don't have the build-essential package installed (dpkg --list|grep build-essential
), you will need to install those to your home directory as well.
I don't like link-only answers, but this link I followed step-by-step on a Fedora machine and it worked without modification. Very, very easy. The binaries end up in your ~/bin directory. You download a tarball, extract the sources, run make
and run make install
and that is it.
As the author states, the 2 prerequisites are gcc and ssh and if you meet these git should work for you as a non-root user.
This is what I ended up doing, the main trick being the make flags:
wget -O git.tar.gz https://github.com/git/git/archive/v2.17.0.tar.gztar zxf git.tar.gzmv git-2.17.0 gitcd gitmake configure./configure --prefix=`pwd` --with-curl --with-expat# ./configure --prefix=`pwd`# Make flags from https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA@mail.gmail.com/make NO_GETTEXT=Nope NO_TCLTK=Nopemake install NO_GETTEXT=Nope NO_TCLTK=Nope
Credits:
79E09796's answer above was a good tip, but didn't work for my case on Cloudways and did not require compiling curl and expat.
A random email record I found on the internet: https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA@mail.gmail.com/