How to run 'rails credentials:edit' on Windows 10 without installing a Linux Subsystem

Issue

I am trying to run the following command on my Rails app on my Windows 10 machine:

rails credentials:edit

But I get the following error message:

No $EDITOR to open file in. Assign one like this:

EDITOR=”mate –wait” bin/rails credentials:edit

For editors that fork and exit immediately, it’s important to pass a
wait flag, otherwise the credentials will be saved immediately with no
chance to edit.

I did some research, and I understand that most people who want to run such aforementioned command on Windows 10 will need to install a Linux Subsystem on their Windows machines. However, such option is not available for me because I don’t have admin rights on my machine. I have attempted installing a Linux subsystem by using resources like the one here without luck.

Solution

I would suggest you switch to non-windows based system if you’re trying to do any rails development as I used to work on a windows machine until I caved in and switched entirely to Mate Linux. It would be so much easier to develop Rails application on Linux platform since you would see almost all gems compiling without any issue and all the rails terminal commands are working without further setup.

However, if you would like to edit your credentials, you need a text editor (Usually vim on Linux) setup before running credentials:edit.

First run SET EDITOR="notepad_path" and then try running rails credentials:edit

You can change notepad_path to any other text editor you prefer. However, some editors like Atom was giving weird issues for me.

Answered By – CodingSomething

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published