ministryofjustice / analytics-platform

Parent repository for the MOJ Analytics Platform
MIT License
14 stars 1 forks source link

default editor error in terminal #50

Closed isichei closed 5 years ago

isichei commented 6 years ago

When using the rStudio terminal to commit to git (i.e. git commit) you get the following error:

error: cannot run vi: No such file or directory
error: unable to start editor 'vi'
Please supply the message using either -m or -F option.

Looks like it's trying to run vim but there is a typo somewhere, however I think previously there would be am rStudio popup that let you write your commit message (but not 100% sure that was the old response).

This very minor / not urgent as you can still use rStudio's git gui or provide an inline message via -m.

xoen commented 6 years ago

FYI: This is because vi is the editor in RStudio:

$ env | grep EDITOR
EDITOR=vi

But vi is not in the $PATH (quite likely vim or any editor is installed):

$ which vi
(noting returned)

I'm afraid we don't have any editor installed in the RStudio docker image.

We could potentially install vi to the already bloated RStudio docker image but probably not a priority given the very limited impact and easy workaround but this is @RobinL 's call.

davidread commented 5 years ago

For git rebase you need an editor - -m is no use.

In this case you need a recent version of rstudio image (3.4.2-6 or later) or get vi or nano installed by an admin. Then set you can switch from vi to nano using the editor env variable in the shell:

$ export EDITOR=nano

or when invoking the command itself:

$ EDITOR=nano git rebase
isichei commented 5 years ago

@davidread closing this as vim or nano (can't remember which one) is now installed on standard rStudio docker build. Feel free to reopen if you think otherwise.