1

How do I delete the GIT_EDITOR variable?

I set it by error and would like to remove it.

It looks like git var can only list variables...

ecstrema
  • 543
  • 1
  • 5
  • 20
  • did you update/add it to .gitconfig file? – dkb Sep 22 '18 at 06:19
  • @dkb: a setting in `.gitconfig` is not an environment variable. Note that while you can set `core.editor` in `.gitconfig`, the environment variable overrides this setting (which makes sense on Unix shells where you can run `GIT_EDITOR=experiment git commit`, for instance, to experiment for one command only). – torek Sep 22 '18 at 15:35

1 Answers1

3

Environment variables are set/exported, and hence unset/unexported, by the outer level shell that runs each command. Hence the way to un-set GIT_EDITOR completely depends on your shell.

In most Unix-style shells, unset is the verb to un-set a variable. If the variable is marked exported, this not only unsets it in the shell but also removes it from the exported environment. Unix csh / tcsh uses unsetenv instead (its unset unsets only shell variables, not environment variables; set sets shell variables and setenv sets environment variables).

I have no idea what do to in DOS-style shells, but Command line to remove an environment variable from the OS level configuration has some advice, plus links to additional StackOverflow questions and answers.

torek
  • 448,244
  • 59
  • 642
  • 775
  • Thank you @torek ! I work in Windows 10 OS and use Git Bash. I was able to unset the GIT_EDITOR by typing in console: `unset GIT_EDITOR` – Sergii May 15 '19 at 12:26