-
-
Notifications
You must be signed in to change notification settings - Fork 429
Open
Description
Problem
When using pyenv-virtualenv on WSL (Windows Subsystem for Linux), some shell scripts can produce the following error:
/usr/bin/env: ‘bash\r’: No such file or directoryThis happens when the repository is cloned with CRLF (Windows-style) line endings, which are incompatible with bash scripts on Linux.
Environment
- WSL2 (Ubuntu 22.04)
- Git default config with
core.autocrlf=true - pyenv + pyenv-virtualenv
- Zsh or Bash
Reproduction
- Clone the repository from Windows Git client (CRLF enabled)
- Add
eval "$(pyenv virtualenv-init -)"to.zshrcor.bashrc - Run
source ~/.zshrc - Error:
/usr/bin/env: ‘bash\r’: No such file or directory
Proposed Solution
Add a .gitattributes file to enforce LF line endings for shell scripts:
*.sh text eol=lfThis will ensure shell scripts are always checked out with Unix-compatible line endings, even on Windows environments.
Additional Notes
- This issue does not affect native Linux or macOS users
- This change would improve developer experience for WSL users significantly
Metadata
Metadata
Assignees
Labels
No labels