Skip to content

Instantly share code, notes, and snippets.

@Saba-Sabato
Last active July 28, 2025 06:06
Show Gist options
  • Select an option

  • Save Saba-Sabato/15e9e0241e978f46850d511057c4656b to your computer and use it in GitHub Desktop.

Select an option

Save Saba-Sabato/15e9e0241e978f46850d511057c4656b to your computer and use it in GitHub Desktop.
How to install git-subtree on Amazon linux

TL;DR run the following:

sudo dnf update
sudo dnf update git
sudo dnf install git-subtree

Background:

The default git package on amazonlinux does not contain the script for git-subtree, and so the following fails:

[home] git subtree add --prefix .vim/bundle/tpope-vim-surround https://bitbucket.org/vim-plugins-mirror/vim-surround.git main
git: 'subtree' is not a git command. See 'git --help'.

The commonly found solution online is to run:

sudo yum update git # For Amazon Linux 2
sudo dnf update git # For Amazon Linux 2023

sudo chmod +x /usr/share/doc/git/contrib/subtree/git-subtree.sh
sudo ln -s /usr/share/doc/git/contrib/subtree/git-subtree.sh /usr/lib/git-core/git-subtree

However, that obviously doesn't work if the module itself isn't installed.

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