gitsudodebian-stretch

Install Git without sudo privilege


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>


Solution

  • 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*