Reputation: 914
When I try to commit the first revision to my git repository (git commit) from Cygwin, I'm getting an error in gvim which says "Unable to open swap file for "foo\.git\COMMIT_EDITMSG" [New Directory]. I think it might be some sort of permission problem, but I've tried removing the read-only flag from the folder, as well as recursively adjusting the owner (using the windows property tab, not chown under Cygwin) to be the account I'm running under, without any luck. If I change the default editor to notepad, I get "The system cannot find the file specified", even though the file (COMMIT_EDITMSG) does exist and even contains:
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# etc...
How can I troubleshoot this problem further?
Upvotes: 1
Views: 2816
Reputation: 51
For `cygpath', try:
cygdrive -a -m COMMIT_EDITMSG
You possibly want path in the following style:
D:/path/to/your/working_directory/.git/COMMIT_EDITMSG
Upvotes: 0
Reputation: 4131
You are using mingw or msysgit git in cygwin (windows native). This will not work when using a cygwin editor (gvim). The \ is no path seperator in POSIX, it rather escapes the next character.
You need to install the cygwin git package or use a proper mingw/msysgit editor.
It might also be that the mingw git.exe is in the PATH before /usr/bin. Fix your PATH then.
Such questions are usually handled via http://cygwin.com/problems.html, esp. cygcheck -s -v -r > cygcheck.out in the mailinglist. Then we could see more.
Upvotes: 1
Reputation: 2187
I faced the same issue first time but I found out that this is normal. Only I don't remember how to deal with Vim. I found solution in that link: http://vim.runpaint.org/basics/quitting-vim/. I used the vim command :x that resulted in saving my comment & committing modifcation. You may read about this integration between Git & Vim through this link: http://vim.runpaint.org/extending/integrating-vim-with-git/.
Upvotes: 0
Reputation: 13357
Unable to open swap file for "foo\.git\COMMIT_EDITMSG" [New Directory].
Looks like the git commit
is passing the file path as a Windows path, not a POSIX path. note the \
in the message.
gvim
is going to try to open `foo.gitCOMMIT_EDITMSG", which doesn't exist.
I don't use git
, but I imagine it uses an environment var similar to SVN_EDITOR
. You may need to wrap the editing session with a small script that uses cygpath
to change the file path from Windows to Posix separators.
#!/bin/bash
gvim "$(cygpath --unix "${1}")"
Caveat Emptor, untested.
Upvotes: 3