In some cases you want to install git where you are only a user,  the .bashrc is not being interpreted, and sshd does not allow you to send the path variables, in short a locked down system. What you do in this case, you unpack the binary packages into some path, and prepend that path via a git ssh command script to your ssh command. Here we do this for sdf, the superdimensional fortress that gives you lifetime shell and web hosting for $36 one time fee (http://sdf.lonestar.org/index.cgi?access). It is running netbsd 6.0 on an amd64 machine , so we fetch the binaries right off the server.

How to install git on sdf as a arpa member :

  1.       mkdir ~.local
          cd ~.local/
          wget http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.0/All/git-base-2.10.0.tgz
          wget http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.0/All/git-2.10.0.tgz
          tar -xzf git-2.10.0.tgz
          tar -xzf git-base-2.10.0.tgz
          rm *.tgz
        
  2. On your client machine :
      1. Setup your ~/.ssh/config
      2. Host sdf
        	  User h4ck3rm1k3 
        	  HostName sdf.org
        	
      3. Setup ssh login script to prepend path
        	    #!/bin/bash
        	    
        	    shift # remove the hostname that is arg1
        
        	    # now we set the path and call the command without the hostname
        	    # host name is sdf that is configured in the .ssh/config
        	    exec /usr/bin/ssh sdf "export PATH=/sdf/arpa/gm/h/h4ck3rm1k3/.local/libexec/git-core/:/sdf/arpa/gm/h/h4ck3rm1k3/.local/bin:/usr/pkg/bin:/usr/local/bin:/usr/bin:/bin;$@"
        	    
        	  
      4. Setup your git config to use custom login script
        	    [core]
        	    repositoryformatversion = 0
        	    filemode = true
        	    bare = false
        	    logallrefupdates = true
        	    sshCommand=/home/mdupont/.ssh/sdfgit.sh
        	    [remote "origin"]
        	    uploadpack = /sdf/arpa/gm/h/h4ck3rm1k3/.local/libexec/git-core/git-upload-pack
        	    url = ssh://sdf:/sdf/arpa/gm/h/h4ck3rm1k3/html
        	  

Sources

  1. https://git-scm.com/docs/git-config
  2. https://linux.die.net/man/5/ssh_config
  3. http://sdf.org/
Advertisements