The problem
For complex reasons rsync/scp/sftp runs .bashrc when connecting to another host. The mere presence of .bashrc is not an issue. Problems arise if any of the commands in .bashrc produces output during a non-interactive session.
A good solution for most cases
Place any of these commands at the top of your .bashrc:
either
# for non-interactive sessions stop execution here -- https://serverfault.com/a/805532/67528
[[ $- != *i* ]] && return
or
# for non-interactive sessions stop execution here -- https://serverfault.com/a/805532/67528
[ -z "$PS1" ] && return
Any of the above commands will only allow the execution of the rest of .bashrc commands for interactive sessions. As far as I know you don't need them for any other type of session (and indeed I have seen default bashrc from Arch and Debian using this technique in their bashrc).
A good solution for rare cases
If you want to be extra paranoid about letting your bashrc commands run even for non interactive sessions you should at least wrap the commands that may produce output like in the example below (reference):
if shopt -q login_shell; then
# this is an interactive session, we _can_ display output
...commands that may produce output goes here...
fi
A solution you should probably avoid
Others suggest moving commands that output text to your bash_profile but I have my doubts about whether this is always good (for reasons explained here)