Home > Back-end >  Install Git without sudo privilege
Install Git without sudo privilege

Time:10-30

I have a non-root account on a Debian 9 (Stretch) System and I want to install Git.

Since the account does not have super-user privileges, Git can only be installed locally, as stated here.

Following the accepted answer, I downloaded and extracted the latest Git version in local home directory (~/) and then I enter the extracted Git folder like

$ cd git-2.33.1/

When I run

./configure --prefix=~/git-2.33.1/ && make && make install

I get ./configure: No such file or directory.

Is there anything I can do?

I also checked the README of git and when I run make I get fatal error: openssl/ssl.h: No such file or directory #include <openssl/ssl.h>

CodePudding user response:

This will be not very easy to have something working if dependencies are missing.

What you can do, download the .deb to get the last git version, you can find it https://debian.pkgs.org/11/debian-main-amd64/git_2.30.2-1_amd64.deb.html

For example:

cd /tmp
wget http://ftp.br.debian.org/debian/pool/main/g/git/git_2.30.2-1_amd64.deb

Then extract it

mkdir git
cd git
ar x ../git_2.30.2-1_amd64.deb

You will get

total 5.3M
drwxrwxr-x  2 john doe 4.0K Oct 29 21:31 ./
drwxrwxrwt 29 root      root       16K Oct 29 21:31 ../
-rw-r--r--  1 john doe  16K Oct 29 21:31 control.tar.xz
-rw-r--r--  1 john doe 5.3M Oct 29 21:31 data.tar.xz
-rw-r--r--  1 john doe    4 Oct 29 21:31 debian-binary

Then extract the data part:

tar xvf data.tar.xz

and you get the binaries

╰┤suze ▶ ls -l usr/bin
total 4968
-rwxr-xr-x 1 john doe 3343280 Mar 10  2021 git*
lrwxrwxrwx 1 john doe       3 Mar 10  2021 git-receive-pack -> git*
-rwxr-xr-x 1 john doe 1733608 Mar 10  2021 git-shell*
lrwxrwxrwx 1 john doe       3 Mar 10  2021 git-upload-archive -> git*
lrwxrwxrwx 1 john doe       3 Mar 10  2021 git-upload-pack -> git*

CodePudding user response:

When I run

./configure --prefix=~/git-2.33.1/ && make && make install

I get ./configure: No such file or directory.

You don't really need the configure script, but if you want it you can just say make configure and run that, if you're having trouble finding ssl you can ./configure --prefix=$HOME --without-openssl.

But all that script does is make some easy edits and the Makefile comes preconfigured to install in your home directory and has lots of comments up top explaining how to set yourself up. For instance,

# Define NO_OPENSSL environment variable if you do not have OpenSSL.

so you can

tar xf the.downloaded.tar
cd ./git-2.33.1
echo NO_OPENSSL = > config.mak

and you're all set up for

make install

to build without openssl support and install to $HOME.

  • Related