In case of remote debugging it makes sense to edit files "in-place", through a disk share, such as Samba or Windows Share (SMB protocol). In this case whenever you save file, it will be saved on the server disk.
Fortunately, SMB protocol can be secured with ssh tunnel and it's what I use myself. See this article for details:
http://www.nusphere.com/products/remote_file_ssh.htm
If you don't like SMB at all, you can google for other 3rd party network share applications. Some of them rely on ssh/sftp connectivity.