Skip to content

Instantly share code, notes, and snippets.

@glegoux
Last active January 25, 2021 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glegoux/85d67b28a6a6a55240e658128b541fc2 to your computer and use it in GitHub Desktop.
Save glegoux/85d67b28a6a6a55240e658128b541fc2 to your computer and use it in GitHub Desktop.
[Bash] Install git without sudo locally for the user on CentOS

First check your version of CentOS:

$ cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)

Now download a rpm package for Git from official mirror of CentOS in your home folder:

$ wget http://mirror.centos.org/centos/7/os/x86_64/Packages/git-1.8.3.1-23.el7_8.x86_64.rpm

Then execute, in your home:

rpm2cpio git-1.8.3.1-23.el7_8.x86_64.rpm | cpio -idm

Your git is installed in ~/usr/bin/.

After update your ~/.bashrc with:

...
# Git
export PATH="$HOME/usr/bin:$PATH"
export GIT_EXEC_PATH=$HOME/usr/libexec/git-core

Note: GIT_EXEC_PATH allows to locate the relative git commands, see that with git --exec-path

Now you have your git installed and working for the current user.

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