Magit is unable to commit anything is giving the following message

1 c:/cygwin64/bin/git.exe … commit -- Waiting for Emacs...

ERROR: Wrong type argument: arrayp, nilerror: There was a problem with the editor '"c:/Program Files (x86)/Emacs/emacs-24.5/bin/emacsclient.exe"'. Please supply the message using either -m or -F option.

How do I pass the -m and -F option?

platform - Windows 8 Emacs - 24.5.1 installed magit from package manager.

I wanted to use cygwin with emacs, having set that, cygwin didnt see the windows git properly - hence I installed git for cygwin. Probably that's causing some issue? In my exec-path I have the path of cygwin-git. I am new to magit so help would be appriciated and also let me know if I can provide with more information.

EDIT : Both the git installation work properly - I tried some test commit from and cygwin and cmdprompt and I am able to commit normally.

  • 1
    All I can say: this is not about passing -m or -F options, that message is a side effect of another problem. You'd probably get more meaningful information if you did M-x toggle-debug-on-error before trying to commit.
    – wvxvw
    Commented Jul 29, 2015 at 15:24
  • 2
    Do not mix Cygwin and Windows programs unless you're ready for a world of hurt. If you want to use Emacs from Cygwin, install the emacs-w32 package and use that.
    – nanny
    Commented Jul 29, 2015 at 16:17
  • I have everything working except magit. Toggling debug on error does nothing. I get no information in message buffer. Any idea on why emacs isn't able to commit?
    – Amit Ahire
    Commented Jul 29, 2015 at 18:29
  • 1
    What magit version are you using? The latest release contains some kludges for cygwin, which should prevent this.
    – tarsius
    Commented Jul 29, 2015 at 19:40
  • M-x magit-version gives me - Magit 20150729.518, Git 2.4.5, Emacs 24.5.1 I uninstalled and reinstalled the package from Emacs package manager. In elpa the latest version is 20150729.518
    – Amit Ahire
    Commented Jul 29, 2015 at 20:23

2 Answers 2

#!/bin/dash -e
if [ "${1#/}" != "$1" ]
then k=$(cygpath -w "$1")
elif [ "$#" != 0 ]
then k=$1
exec emacsclient ${k+"$k"}
  1. If no path, pass no path

  2. If path is empty, pass empty path

  3. If path is relative, pass as is

  4. If path is absolute, convert to Windows format

Then I set these variables:

export EDITOR=emacsclient.sh
export GIT_EDITOR='dash /usr/local/bin/emacsclient.sh'
  1. EDITOR allows script to work with Git

  2. GIT_EDITOR allows script to work with Hub commands



Posted multiple times because I thought github repo was only for feature request and also tried the chat but there was no activity.

Anyway the problem seem to be proper initialization and setup of cygwin on windows. I tried the setup suggested by benquike in https://github.com/magit/magit/issues/1318 -- Restating it here.

  1. Download cygwin-mount.el( For links go the link above or replace the @ with : http@//emacswiki.org/emacs/cygwin-mount.el) to somewhere
  2. download setup-cygwin.el(http://www.emacswiki.org/emacs/setup-cygwin.el) to somewhere
  3. in your init.el(or .emacs),add the following
(add-to-list 'load-path "where you placed cygwin-mount.el and setup-cygwin.el")
(require 'setup-cygwin)

Only problem seem to be that you cannot place the .el files mentioned above in your .emacs.d folder but instead place it in a subdirectory. (As with the new version of Emacs they are "discouraging" that)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.