Linux

Bash.rc And Environment Variables Not Loading On SSH

Posted by Weston Ganger on May 31, 2015

I was having some issues with my .bashrc file not being loaded when SSHing.

To fix it add this to the beginning of your .profile file.


# ~/.profile

# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
  . "$HOME/.bashrc"
fi

Also if you are running a non-interactive SSH shell such as when using Capistrano or another tool, you must make sure you set your variables before this line in your .bashrc


# ~/.bashrc

# PLACE YOUR ENVIRONMENT VARIABLES HERE

# If not running interactively, don't do anything
[ -z "$PS1" ] && return


Related External Links:


Posted in Linux and Tagged with bash ssh capistrano 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts