Isso acontece porque você está fazendo login através de ssh
. Tudo se resume às diferenças entre os shells de login e não-login. Quando você se conecta via ssh, você executa um shell interativo de login. Como explicado em man bash
, esse tipo de shell irá:
When bash is invoked as an interactive login shell, or as a non-inter‐ active shell with the --login option, it first reads and executes com‐ mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
Em outras palavras, ~/.bashrc
é ignorado por padrão ao executar shells de login. A solução simples é fornecer explicitamente a partir de um dos arquivos que são lidos. Como você pode ver acima, os shells de login primeiro tentarão ler ~/.bash_profile
e, se isso não existir, ~/.bash_login
, e se isso também não existir, eles lerão ~/.profile
. Como você tem um arquivo ~/.bash_profile
, precisará adicionar essas linhas a ele:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi