When I tried to use scp to copy a file on a distant machine:
scp -v filename email@example.com:/home/username
it looked as if the SCP command works but the file is not copied. The interactive option (-v) does not provide any hints.
The problem seems to reside in the bash environment. If I remove the different parts of the bashrc, it works. So, you need to disable the bashrc. It seems to be known that when called by SSH, an SCP command calls the user’s login shell. To disable it, add this line in the .bashrc file in the home directory:
[ -z "$PS1" ] && return