opensafely-core / research-template-docker

This provides the devcontainer Docker image used by repos created from the OpenSAFELY research template.
Other
0 stars 0 forks source link

Git editor for commits and interactive rebases missing #49

Closed Jongmassey closed 3 weeks ago

Jongmassey commented 1 month ago
$ git commit
hint: Waiting for your editor to close the file... error: cannot run editor: No such file or directory
error: unable to start editor 'editor'
Please supply the message using either -m or -F option.
$ git rebase -i HEAD
hint: Waiting for your editor to close the file... error: cannot run editor: No such file or directory
error: unable to start editor 'editor'

We need to configure an editor for git for this to work. From the git docs:

core.editor By default, Git uses whatever you’ve set as your default text editor via one of the shell environment variables VISUAL or EDITOR, or else falls back to the vi editor to create and edit your commit and tag messages. To change that default to something else, you can use the core.editor setting:

$ git config --global core.editor emacs Now, no matter what is set as your default shell editor, Git will fire up Emacs to edit messages.

Jongmassey commented 1 month ago

My inclination is to set VS Code as the editor, but that might not work very well if people are using these commands from a terminal in RStudio

lucyb commented 1 month ago

Consider using a simple editor, such as Nano. We should stick with using a terminal editor, if people are using git from the command line.

Jongmassey commented 1 month ago
 rstudio@codespaces-d5e8c7:/workspaces/bennett-coding-away-day$ nano
bash: nano: command not found

We'll have to apt install it

Jongmassey commented 1 month ago

Nor vi

rstudio@codespaces-d5e8c7:/workspaces/bennett-coding-away-day$ vi
bash: vi: command not found
lucyb commented 1 month ago

It appears that Ubuntu minimal server install, which I'm assuming this is using (although I haven't checked) doesn't ship with an editor. There's more info here, although I suspect that apt installing nano will just work.