How to use VSCode to remotely edit website files?

前端 未结 8 1324
忘了有多久
忘了有多久 2020-12-18 00:53

I need to be able to remotely log into web servers for my clients and edit code remotely. I mostly use this for CSS changes, but also am starting to play with PHP as well. <

8条回答
  •  清酒与你
    2020-12-18 01:33

    There are several approaches to this that are all editor-agnostic.

    First, there is sshfs, which is cross-platform and you can install via your OS package manager. A simple approach would be as following:

    mkdir -p ~/mnt/server
    sshfs user@server.example.com:/path/on/server ~/mnt/server
    

    Afterwards, you have the complete folder structure from server.example.com locally available at ~/mnt/server. Make sure you set up SSH keys to avoid entering the user password every time. You can find tutorials on that everywhere on the net.

    For servers that only offer FTP access (shared hosting and the like), you can use curlftpfs in the same fashion.

    To close the connection, simply unmount:

    umount ~/mnt
    

    For a GUI-based approach, you have several options. There is Transmit (macOS), which features mounting connections as volumes, Forklift (macOS) which is a Finder replacement that can do the same, ExpanDrive (macOS/Windows) and my favorite Mountain Duck (macOS/Windows).

    If you plan to move lots of data, especially a lot of small files, Mountain Duck performs the best in my experience.

提交回复
热议问题