本文介绍了发出打开凭据文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此命令打开凭据文件.

I am trying to open credentials file with this command.

rails credentials:edit

它返回:

没有 $EDITOR 来打开文件.像这样分配一个:

EDITOR="mate --wait" bin/rails 凭证:编辑

EDITOR="mate --wait" bin/rails credentials:edit

对于 fork 并立即退出的编辑器,重要的是传递一个等待标志,否则凭据将立即保存,没有有机会编辑.

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.

所以我做了这个命令:

EDITOR="subl --w" bin/rails credentials:edit

但是,终端会在不打开编辑器的情况下以加密并保存的新凭据"作为响应.

However, terminal responds with "New credentials encrypted and saved" without opening an editor.

推荐答案

您是否为 wait 使用了正确的别名?在官方文档中有:
-w 或 --wait:等待文件关闭后再返回

Are you using the correct alias for wait?In official documentation there is:
-w or --wait: Wait for the files to be closed before returning

所以应该是:
EDITOR="subl --wait" bin/rails 凭证:编辑.

我刚刚在 ubuntu 上用 vs 代码和 atom 测试了这个,它工作正常:
EDITOR="code --wait" rails 凭证:编辑.
EDITOR="atom --wait" rails 凭证:编辑.

I've just tested this on ubuntu with vs code, and atom and it worked correctly:
EDITOR="code --wait" rails credentials:edit.
EDITOR="atom --wait" rails credentials:edit.

还要检查 subl 是否正确添加到系统变量路径中.

Also check if subl is correctly added to system variable path.

这篇关于发出打开凭据文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:56