git is installed on all DreamHost servers by default, but if you'd like to run the most recent version, you are able to install it locally under your username. This article walks you through how to install a custom version of git that your Shell will use when you log in via SSH.
- Log into your DreamHost server via SSH.
- Visit the Linux downloads page.
- There is a link in the first paragraph to the most recent version. Right-click this and choose Copy Link Address.
- Make sure you're in your user's home directory.
[server]$ cd ~
- Run the following command to download git.
Change the version to the link you copied.
[server]$ wget https://www.kernel.org/pub/software/scm/git/git-2.34.1.tar.gz
- Decompress the file.
[server]$ tar -zxf git-2.34.1.tar.gz
This creates a new directory named after the version number.
- Change into this new directory.
[server]$ cd git-2.34.1
- Run the following commands one at a time to install. Make sure to change the username to your SSH user.
[server]$ make prefix=/home/username/local all [server]$ make prefix=/home/username install [server]$ exec bash
- Run the following command to confirm the new version of git is being used.
[server]$ git --version
Update your .bash_profile
Now that git is installed, you should update your .bash_profile to automatically load it when you log into your server via SSH.
- Log into your server via SSH.
- Edit the .bash_profile file to add the following line.
[server]$ export PATH=$HOME/local/bin:$PATH
When you log into your server in the future, the new version of git will load automatically.