Skip to content

Instantly share code, notes, and snippets.

@pourmand1376
Last active June 18, 2026 05:18
Show Gist options
  • Select an option

  • Save pourmand1376/bc48a407f781d6decae316a5cfa7d8ab to your computer and use it in GitHub Desktop.

Select an option

Save pourmand1376/bc48a407f781d6decae316a5cfa7d8ab to your computer and use it in GitHub Desktop.
Single User Installation of Git-LFS without sudo

I wanted to install GIT-Lfs on my user account without access to server root account. I write this to my future self.

  1. Download tar.gz file from git-lfs website.
wget https://github.com/git-lfs/git-lfs/releases/download/v3.2.0/git-lfs-linux-amd64-v3.2.0.tar.gz

2.Untar it

tar xvf git-lfs-linux-amd64-v3.2.0.tar.gz
  1. Go to directory
cd git-lfs-3.2.0/
  1. give permission to file install.sh
chmod +x install.sh
  1. Edit file install.sh and change prefix from /usr/local/ to $HOME/.local (Fix bug that @G-Thor has mentioned)
sed -i 's|^prefix="/usr/local"$|prefix="$HOME/.local"|' install.sh
  1. Do not forget to create .local/bin in your home folder if that doesn't exist. Add Path .local/bin path to terminal.
mkdir -p ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH"
  1. Now you can run ./install.sh to install git-lfs.
./install.sh

You should see Git LFS Initalized.

  1. Check your installation:
git-lfs --version
  1. Add .local/bin to .bashrc or whatever shell you use. This step is to make sure that your shell can find git-lfs binaries.

All in one (just copy and paste into terminal):

wget https://github.com/git-lfs/git-lfs/releases/download/v3.2.0/git-lfs-linux-amd64-v3.2.0.tar.gz
tar xvf git-lfs-linux-amd64-v3.2.0.tar.gz
cd git-lfs-3.2.0/
chmod +x install.sh
sed -i 's|^prefix="/usr/local"$|prefix="$HOME/.local"|' install.sh
mkdir -p ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH"
./install.sh
git-lfs --version
@DanRunfola

Copy link
Copy Markdown

Thank you, past self.

@adipill04

Copy link
Copy Markdown

After doing this, is access to the command "git lfs" possible? I have made sure my env variables and .bashrc file are all configured correctly, and ran install.sh as "./install.sh".

@G-Thor

G-Thor commented Mar 8, 2024

Copy link
Copy Markdown

The current (v.3.4.1) version of the installation script appends "/bin" to the prefix after it is declared so changing prefix="$YOUR_HOME/.local/bin" to prefix="$YOUR_HOME/.local" may solve the problem for @adipill04

@adipill04

Copy link
Copy Markdown

The current (v.3.4.1) version of the installation script appends "/bin" to the prefix after it is declared so changing prefix="$YOUR_HOME/.local/bin" to prefix="$YOUR_HOME/.local" may solve the problem for @adipill04

@G-Thor That sure was the problem-- there was a mismatch between PATH variable & the actual path I had installed git lfs in. Thanks for your help!

@zimingH

zimingH commented Apr 9, 2024

Copy link
Copy Markdown

Wow, thank you so much! I also encountered the "./local/bin" issue. Thank you all!

@Mao-KU

Mao-KU commented Apr 24, 2024

Copy link
Copy Markdown

Thank you, past self.

@Ayush-00

Copy link
Copy Markdown

Thank you!

@icedwater

Copy link
Copy Markdown

As of at least v3.5.1, there is a --local option you can pass which sets the prefix to $HOME/.local; just make sure the directory exists first.

To wit:

mkdir ~/.local
./install.sh --local

@amina-mardiyyah

Copy link
Copy Markdown

This was really helpful. Thank you

@HYZ17

HYZ17 commented Jul 29, 2024

Copy link
Copy Markdown

Thank you !

@rhngla

rhngla commented Aug 18, 2024

Copy link
Copy Markdown

The current (v.3.4.1) version of the installation script appends "/bin" to the prefix after it is declared so changing prefix="$YOUR_HOME/.local/bin" to prefix="$YOUR_HOME/.local" may solve the problem for @adipill04

Thanks @G-Thor, this was the fix I needed as well for v3.5.1. Also thanks to @pourmand1376 for these instructions!

@suraj-adewale

Copy link
Copy Markdown

This is really helpful. Thanks

@Zikkying

Copy link
Copy Markdown

Many thanks

@liwd190019

Copy link
Copy Markdown

shouldn't it be as easy as conda install -c conda-forge git-lfs after installing conda?

@LiuLime

LiuLime commented May 15, 2025

Copy link
Copy Markdown

shouldn't it be as easy as conda install -c conda-forge git-lfs after installing conda?

Haha, really. I tried conda, succeed under ubuntu without sudo privileges. Thank you for extra information.

@maikol-solis

Copy link
Copy Markdown

Thanks. You saved my day today.

@ZongfangLiu

Copy link
Copy Markdown

Thank you so much! Life saver!

@FAOlivieri

Copy link
Copy Markdown

Thank you

@maoyuanpeng

Copy link
Copy Markdown

thank you

@DmitriiKosenko

Copy link
Copy Markdown

Thank you

@jyue487

jyue487 commented Jun 10, 2026

Copy link
Copy Markdown

conda solution was perfect. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment