Can't deploy from Macbook to remote server by rsync

I have a site ready to deploy to my server, so I’ve been following the tutorial on the topic. A few issues:

  • I copied the SSH key to the server, and I can see the key in the authorized_keys file, but it still won’t let me SSH into the server without a password. I’ve changed the permissions, fiddled with the config files, and doublechecked that the key isn’t split across lines, but nothing fixes this issue.
  • If I carry-out the deploy script, I get a lot of weird errors. I have no idea if this error is connected to the previous error and the error message is so bizarre that it makes it very difficult to look up solutions. Here’s one of the error messages:
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at /AppleInternal/Library/BuildRoots/20d6c351-ee94-11ec-bcaf-7247572f23b4/Library/Caches/ [sender=2.6.9]

I’ve searched far and wide, following the advice of forum threads like this one, but nothing works. I feel like either I’m missing something so absolutely fundamental that it simply wasn’t mentioned in the tutorial, or that something weird is going on with Apple (I have an M1, if that makes a difference). Any help you could provide would be amazing. Thanks.

I think I figured it out after a lot of trial and error. Basically, the HOST in ~/.ssh/config needs to be exactly the same as that in the deploy script. So you can’t put an IP address in one and the hostname in the other. Maybe I’m just extraordinarily thick, but that should probably be mentioned in the tutorial.

Anyway, I hope this helps someone else out there if they’re experiencing the same problem.