0

To briefly summarize, I am learning version control and a part of my course is configuring a code editor to my terminal.

This was easy enough initially, however after I changed my code editor from atom to sublime text in an attempt to fix a git commit issue I found that sublime text was even more problematic than atom.

While trying to switch back to atom, I have found that none of the commands I was given to remove "subl -n -w" from my core.editor settings are working now.

git config --global --replace-all core.editor "editor-config-code"

git config --global --unset-all core.editor

When running "git var -l", this is the result I get:

credential.helper=osxkeychain
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
user.name=Xxx Xxxxxxxx
user.email=xxxxxxxx@yahoo.com
core.editor=atom
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
core.editor=subl -n -w
GIT_COMMITTER_IDENT=Tim Sherwood <tsher004@yahoo.com> 1574301511 -0500
GIT_AUTHOR_IDENT=Tim Sherwood <tsher004@yahoo.com> 1574301511 -0500
GIT_EDITOR=subl -n -w
GIT_PAGER=less

. . . and this is what comes up when I execute "git commit"

hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Please supply the message using either -m or -F option.

Ideally this command should open the atom code editor installed on my Mac and present me with the option to supply a message for the commit. So far I have not had much luck with this.

Any help would be appreciated.

  • It appears your `~/.gitconfig` isn't getting updated for whatever reason; you could try editing it manually. – l'L'l Nov 23 '19 at 05:17

1 Answers1

0

From the git-var documentation:

The order of preference is the $GIT_EDITOR environment variable, then core.editor configuration, then $VISUAL, then $EDITOR, and then the default chosen at compile time, which is usually vi.

Hence, you need to unset or edit the $GIT_EDITOR environment variable since it has precedence over core.editor.

Also, take note that your output for git -var l lists core.editor twice. So you should really sort that out in either ~/.gitconfigor your local .git/config.

idleberg
  • 12,634
  • 7
  • 43
  • 70
  • Thanks, I'm very new to all of this. Could you direct me to a site that goes over the code I need to make these edits? – Tim Sherwood Nov 23 '19 at 22:24
  • . . . also, I understand git config as a command, but I'm not sure what ~/.gitconfig and .git/config are other than locations on storage. – Tim Sherwood Nov 23 '19 at 22:26
  • Open those git config files in the text editor of your choice, make the changes and save them. – idleberg Nov 23 '19 at 23:45
  • See this [answer](https://stackoverflow.com/questions/6877727/how-do-i-delete-an-exported-environment-variable) for how to unset environment variables. – idleberg Nov 23 '19 at 23:59
  • For my course I am supposed to use the command [git config --global core.editor atom --wait] to configure atom to terminal for commits. Then [git commit] is supposed to open atom. This is what it tells me and I am struggling to figure out what the error is and how to fix it. [hint: Waiting for your editor to close the file... atom --wait: atom: command not found error: There was a problem with the editor 'atom --wait'. Please supply the message using either -m or -F option.] – Tim Sherwood Nov 24 '19 at 01:54