Yet another “change stuff just to change stuff” explanation and fix.
Problem: you see “No such file” or “path canonicalization failed” after an scp command line that used to work correctly.
tim@timub2404:~/eclipse-work$ scp -r socialsecurity.git tim@reposerver:/home/tim/
tim@reposerver's password:
scp: realpath /home/tim/socialsecurity.git: No such file
scp: upload "/home/tim/socialsecurity.git": path canonicalization failed
scp: failed to upload directory socialsecurity.git to /home/tim/
Fix: add a “-O” argument to your “scp” command line:
The -O tells scp to use the Original algorithm.
tim@timub2404:~/eclipse-work$ scp -r -O socialsecurity.git tim@reposerver:/home/tim/
tim@reposerver's password:
HEAD 100% 21 11.5KB/s 00:00
0b582a00b112f748f21bb23ffa752914571733 100% 824 319.8KB/s 00:00
fc089c9ada51bd2c992218e71b647639bd1120 100% 845 612.1KB/s 00:00
<<snip unhelpful>>
config 100% 136 98.3KB/s 00:00
Do you care why you need “-O”? I know I don’t. Ubuntu 24.04 upgraded its version of scp, so now you need it. The current man page says “The legacy SCP protocol (selected by the -O flag) requires execution of the remote user’s shell to perform glob(3) pattern matching. This requires careful quoting of any characters that have special meaning to the remote shell, such as quote characters.”
Which, for the above example, is just incorrect. The command line has no “~” or anything else that requires glob() pattern matching.
BTW – another valid work-around is to put your directory into a single .tgz file, and scp that without the -r command line argument.