Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 494
Mahmoud Mousa Hamad Avatar asked Aug 07 '19 21:08

Mahmoud Mousa Hamad


1 Answers

I'm using VS Code and Powershell within VS Code, and this works for me:

> $env:EDITOR="code --wait"
> rails credentials:edit

Credit goes to this article https://flexpoint.tech/2020/05/16/editing-rails-6-0-credentials-on-windows/ by J. Pablo Fernández

like image 195
Molp Burnbright Avatar answered Oct 06 '22 01:10

Molp Burnbright