GIT Commit Does Not Work With WSL
Hi,
When I attempt a commit in the IDE I get the error
/usr/bin/env: ‘ruby’: No such file or directory
When I do a commit from the command line inside wsl everything works fine.
I am running RubyMine 2025.3.1 on Windows 11 using WSL. I am using wsl native(?), not the bridge. I am using overcommit, whose shebang is
#!/usr/bin/env ruby
Any suggestions about how to correct the problem?
Thanks
请先登录再写评论。
Could you please share the following?
• IDE logs collected via Help | Collect Logs and Diagnostic data
• The path to the Git executable in Settings | Version Control | Git.
• The VCS Console output from the failed commit attempt
You can upload logs securely to https://uploads.jetbrains.com/ and provide the uploaded file ID in your reply.
upload id: 2026_01_06_m73zyusotXoG3zsSA8BZKP
There is no git path entered. The input field says auto-detected: \\wsl.localhost\Ubuntu\usr\bin\git
Console output:
20:37:45.136: [\\wsl.localhost\Ubuntu\mnt\c\Users\swdev\projects\traveller] /usr/bin/git -c credential.helper= -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -f -- config/routes.rb
20:37:46.781: [\\wsl.localhost\Ubuntu\mnt\c\Users\swdev\projects\traveller] /usr/bin/git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F /tmp/git-commit-msg-cONtak.txt --
/usr/bin/env: ‘ruby’: No such file or directory
Thank you for the information. It seems likely that the IDE isn't loading your environment variables properly, causing it not to find ruby when your overcommit hooks try to run.
Can you try updating your shell configuration by moving your version manager's initialization logic (e.g.,
eval "$(rbenv init -)") to a configuration file that is loaded for non-interactive shells: e.g.~/.zshenv.or~/.bash_profile.and restart the IDE. Please let me know if that works as a workaround.That does not solve the problem.
.bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
export RBENV_ROOT="$HOME/.rbenv"
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
restarted RubyMine, I still get the error
14:34:10.207: [\\wsl.localhost\Ubuntu\mnt\c\Users\swdev\projects\traveller] /usr/bin/git -c credential.helper= -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -f -- app/models/concerns/generator_mappings.rb
14:34:11.325: [\\wsl.localhost\Ubuntu\mnt\c\Users\swdev\projects\traveller] /usr/bin/git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F /tmp/git-commit-msg-4NENxJ.txt --
/usr/bin/env: ‘ruby’: No such file or directory
Please run this in RubyMine’s built-in terminal and also in a regular WSL terminal and let me know the result of both:
From WSL
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
From the terminal window in RubyMine
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
Swdevlin , thank you for the information. I was able to reproduce your issue and got it working by copying the rbenv init configuration from
.bashrcto.profile. However, it seems the configuration I suggested before wasn't correct for your environment. Please check your~/.bashrcfor a line added by rbenv (see screenshot) and append that line to your~/.profileand restart RubyMine. It should be similar or the same aseval “$(~/.rbenv/bin/rbenv init - --no-rehash bash)”.Please also enable the registry key:
git.wsl.exe.executable.login.shellby:Shifttwice (open Search Everywhere) > search for Registry.. > find the mentioned registry key > enable it > restart the IDE.Bingo. Works properly now.
Thanks so much,