1

My current git config core.editor returns dreamweaver which I set up two years ago from inside the app(IIRC), and now I don't use it. I am receiving error while amending the author of the last commit.

~$ git commit --amend --author="me <my@mail>"
hint: Waiting for your editor to close the file... fatal: cannot run 
dreamweaver: No such file or directory
error: unable to start editor 'dreamweaver'

How do I set it to use Xcode? I tried

git config --global core.editor="xcode"
error: invalid key: core.editor=Xcode

And from https://stackoverflow.com/questions/53550025/git-unable-to-start-xcode-from-terminal-on-mac-os-x, even though xed launches Xcode.

$ git config --global core.editor="xed"
error: invalid key: core.editor=xed

xed -w also launches Xcode so I tried the same instead of ="xed -w" but same error.

1

It's all about syntax sometimes :-)

git config --global core.editor 'xed -w'

Not sure whether you really want to wait for Xcode to launch each time you git commit something. Maybe vi or nano are the better options here.

  • @ankiiiiiii Not sure whether you really want to wait for Xcode to launch every time you commit something. – nohillside Aug 25 at 9:45
  • it would mostly be open. But seems like a trouble. Should I set it to a light weight editor? – ankii Aug 25 at 9:46
  • @ankiiiiiii Well, I have set it to open a new buffer within (an already running) Emacs. Otherwise I would probably just use vi or nano – nohillside Aug 25 at 9:48
  • could you add to your answer about resetting the editor please? – ankii Aug 25 at 9:49
  • @ankiiiiiii Resetting what? Just change the value you assign :-) – nohillside Aug 25 at 9:53
1

I would never want to do what you want, I think it's a horrible idea, but I tried to, and I succeeded!

What did I do? Easy:

  1. Open Xcode and remove the splash window from the boot (in case it could create some mayhem).

  2. Find Xcode: well, it's hard to explain how, but I found it at /Applications/Xcode.app/Contents/MacOS/Xcode.

  3. Repeat your mistake:

$ git config core.editor=/Applications/Xcode.app/Contents/MacOS/Xcode 
error: invalid key: core.editor=/Applications/Xcode.app/Contents/MacOS/Xcode
$ _
  1. Make it right:
$ git config core.editor /Applications/Xcode.app/Contents/MacOS/Xcode 
$ echo $?
0
$ _
  1. Cloned a repo, made a silly change, added it to the index.

  2. git commit, tada!

Editing commit message on Xcode

If you have any issues repeating this, go back to step 5.

  • May I point out the absence of step 5(neither in markdown) and also ask for comments on the other answer, I think I am going to accept that one. it solved the silly issue. – ankii Aug 25 at 9:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .