When setting up Borg if you get the following error

Remote: bash: line 1: borg: command not found
Connection closed by remote host. Is borg working on the server?

This was because only the .bashrc is executed for non-interactive sessions and inside the .bashrc of at least Ubuntu (24.04) is the following at the very top of the file. This meant that in my case I needed to put the path related environment variables above the following lines so SSH could find the borg command.

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac