Noob question: What's the easiest way to edit code in a file hosted in a droplet on Digital Ocean?

I’ve used the 1-click setup for a Ghost blog and I’m now trying to configure mail setup as explained here:

I’m using Windows 8 and wondering what is the easiest way to edit the config.production.json file.

Can I do it locally using a code editor like Visual Studio Code or Sublime Text or do I need to do it via the command line using PuTTY or something?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I use ssh and vim to edit the text. I also edit my project locally using git and pull updates to my server.

There’s a few ways to edit a configuration file such as this one, on a Droplet.

  • Log in via ssh and use a text editor right in the shell on the command line on the Droplet

Many of the tutorials in our community refer to using either the nano or vi editor directly on the command line in the terminal on the Droplet, including this one:

  • Edit the text locally, and replace the contents of a file via the same text editors

Another simple way is to use your preferred local editor, and simply copy and paste the text to be changed into your local editor, make your changes, and copy / paste those back in via the nano editor in the ssh shell session on the Droplet. Quick and useful if the edits are likely to be infrequent or one-time.

  • Edit locally and replace the file on the Droplet via secure copy

You can also copy a file you’ve edited and saved locally to your Droplet using scp (you’ll need a copy of the file saved locally first of course). This is something you do from the command line on your local computer. This answer explains how:

I use SFTP (SSH File Transfer Protocol) in the FileZilla FTP Client, using:

For the User: root

For the Host: the ip address of the droplet (i.e. 111.222.333.444)