西格温 + 尝试创建提交消息时出现 git 权限问题
当我尝试从 Cygwin 将第一个修订提交到我的 git 存储库 (git commit) 时,我在 gvim 中收到错误,显示“无法打开“foo\.git\COMMIT_EDITMSG”[新目录]的交换文件。我认为这可能是某种权限问题,但我尝试从文件夹中删除只读标志,并递归地将所有者调整为我的帐户(使用Windows属性选项卡,而不是Cygwin下的chown)如果我将默认编辑器更改为记事本,我会在以下情况下运行:“系统找不到指定的文件”,即使该文件(COMMIT_EDITMSG)确实存在,甚至包含:
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# etc...
如何进一步解决此问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看起来 git commit 正在将文件路径作为 Windows 路径而不是 POSIX 路径传递。 请注意消息中的
\
。gvim
将尝试打开 `foo.gitCOMMIT_EDITMSG",它不存在。我不使用
git
,但我想它使用类似于以下的环境变量SVN_EDITOR
。您可能需要使用一个小脚本来包装编辑会话,该脚本使用cygpath
将文件路径从 Windows 更改为 Posix 分隔符,未经测试。
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 toSVN_EDITOR
. You may need to wrap the editing session with a small script that usescygpath
to change the file path from Windows to Posix separators.Caveat Emptor, untested.
您正在 cygwin(Windows 本机)中使用 mingw 或 msysgit git。 当使用 cygwin 编辑器 (gvim) 时,这将不起作用。 \ 在 POSIX 中不是路径分隔符,而是转义下一个字符。
您需要安装 cygwin git 软件包或使用适当的 mingw/msysgit 编辑器。
也可能是 mingw git.exe 位于 /usr/bin 之前的 PATH 中。 然后修复你的路径。
此类问题通常通过 http://cygwin.com/problems.html 处理,尤其是。 cygcheck -s -v -r > > 邮件列表中的 cygcheck.out。 然后我们就能看到更多。
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.
我第一次遇到同样的问题,但我发现这是正常的。 只是我不记得怎么对付Vim了。 我在该链接中找到了解决方案: http://vim.runpaint.org/basics/quitting- vim/. 我使用 vim 命令 :x 保存了我的评论 & 提交修改。
您可以阅读有关 Git 和 Git 之间的集成的信息。 Vim 通过此链接: http://vim.runpaint.org/extending/集成-vim-与-git/。
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/.
对于“cygpath”,请尝试:
cygdrive -a -m COMMIT_EDITMSG
您可能需要以下样式的路径:
D:/path/to/your/working_directory/.git/COMMIT_EDITMSG
>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