PyCharm, WSL, git: commit failed with cryptic error

Answered

Using PyCharm Pro 2018.3.3 (Build #PY-183.5153.39), using git 2.7.4 from Ubuntu (under WSL with git.cmd trick).

When trying to commit, I get this error:

[Time] Commit failed with error
0 files committed, 1 file failed to commit: [commit message]
The system cannot find the file specified.

When checking .git/COMMIT_EDITMSG, it doesn't display the message of the commit that failed. This suggests to me this issue is not this but may be related? I can pull, checkout, clone fine, but can't push or commit. And from bash, git works fine, is able to commit & push. How can check which is the file specified that the system could not find? Git's core.editor is nano, for which I've also got a nano.cmd entry that works from cmd.exe, so both git & nano are commands known to Windows-side programs (i.e. not just WSL).

In a different machine, using also the git.cmd trick, the setup works fine.

5 comments
Comment actions Permalink

> The system cannot find the file specified.

This looks more like the commit command includes a path to a file that is wrong. It could happen because the mentioned hack doe not ensure correct path translation, while Windows and WSL use different path separators.

> And from bash

It is not a valid test - various shells, and especially WSL, is a custom environment which does a lot to configure. IDE commands are executed neither in GitBash nor in WSL.  The closest to what IDE has is WIndows Command Prompt. Does commit work there?

BTW, make sure to use the same command IDE executes - you can see on in the Console tab.

> .git/COMMIT_EDITMSG doesn't display

It saves the message of the last successful commit, so it is expected

> can't push or commit

These are two very different actions and the reasons for failing might be different.

 

0
Comment actions Permalink

Git works as expected inside cmd.exe, using the WSL version (no other git is installed).

From cmd.exe, I can call "git commit". This causes Nano to be opened (see above, nano.cmd exists), I can write the commit message, and save it. Then "git push" asks for the credentials and pushes to the repo.

0
Comment actions Permalink

It is not clear what the actual error is that prevents committing. Logs should have more details.

Please submit a request to https://youtrack.jetbrains.com/issues/IDEA with logs attached to troubleshoot

0
Comment actions Permalink

Created at https://youtrack.jetbrains.com/issue/PY-34102

After looking at the log, I saw PyCharm is looking for a file that does not exist, the `git-commit-msg-.txt` file; I can't see when that file ought to have been created.

Tail of log supplied on the YouTrack ticket.

0
Comment actions Permalink

This is the wrapper fault. Consider using another wrapper, or, better, GitForWindows.

See https://youtrack.jetbrains.com/issue/IDEA-207567#focus=streamItem-27-3303863.0-0

0

Please sign in to leave a comment.