Skip to content

fix: disable autocrlf on git clone to fix WSL issues#7916

Merged
jdx merged 2 commits intomainfrom
fix/git-clone-crlf
Jan 31, 2026
Merged

fix: disable autocrlf on git clone to fix WSL issues#7916
jdx merged 2 commits intomainfrom
fix/git-clone-crlf

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Jan 30, 2026

Summary

  • Adds -c core.autocrlf=false to git clone commands to prevent CRLF line ending conversion

Problem

On WSL, git may be configured with core.autocrlf=true (Windows default), which converts LF to CRLF line endings when cloning repositories. This causes shell scripts (like ruby-build's install.sh) to fail with errors like:

: not found 5: 
install.sh: 6: set: Illegal option -

The carriage returns (\r) are interpreted as part of commands, causing the shell to fail.

Solution

Pass -c core.autocrlf=false to the git clone command to ensure line endings are not converted, regardless of the user's global git configuration.

Test plan

  • Linting passes
  • Test on WSL with core.autocrlf=true set globally

Fixes #7913

🤖 Generated with Claude Code


Note

Low Risk
Low risk: this only forces core.autocrlf=false on the project’s git subprocesses to prevent CRLF conversion issues (notably on WSL), without changing repository selection or network behavior.

Overview
Forces core.autocrlf=false on all git subprocess invocations via the git_cmd! macro, ensuring checkouts/updates don’t convert LF to CRLF based on a user’s global Git config.

Also passes the same config explicitly to git clone (via CmdLineRunner) so newly cloned repos keep LF line endings and avoid script failures on environments like WSL.

Written by Cursor Bugbot for commit 54c77d8. This will update automatically on new commits. Configure here.

On WSL, git may be configured with core.autocrlf=true (Windows default),
which converts LF to CRLF line endings when cloning. This causes shell
scripts to fail with errors like "set: Illegal option -" because the
carriage returns are interpreted as part of commands.

Fixes #7913

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 30, 2026 18:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a WSL compatibility issue where git's core.autocrlf=true setting causes shell script failures by converting LF line endings to CRLF during repository cloning. The fix ensures line endings remain unchanged regardless of user git configuration.

Changes:

  • Added -c core.autocrlf=false flag to git clone commands to disable automatic line ending conversion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves compatibility for users operating within Windows Subsystem for Linux (WSL) environments. It resolves a specific problem where Git's default line ending conversion on Windows could corrupt shell scripts upon cloning, making them unexecutable. The change ensures that repositories are cloned with consistent line endings, regardless of the user's global Git configuration, thereby preventing common script execution errors.

Highlights

  • WSL Compatibility Fix: Addresses an issue where git clone operations on Windows Subsystem for Linux (WSL) could lead to script execution failures due to incorrect line ending conversions (CRLF).
  • Line Ending Management: Explicitly disables Git's core.autocrlf setting during clone operations by adding -c core.autocrlf=false to prevent automatic conversion of LF to CRLF line endings, ensuring script integrity.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue with git's core.autocrlf setting on WSL by disabling it for git clone commands. The change is correct and directly solves the stated problem for cloning. However, the fix might be incomplete as other git commands that check out files could still be affected. I've added a comment with a suggestion to make the fix more comprehensive.

Comment on lines +154 to +155
.arg("-c")
.arg("core.autocrlf=false")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This correctly disables autocrlf for git clone, which resolves the issue for fresh clones. However, the same line-ending problem can occur with other git commands that check out files into the working directory. To make this fix more comprehensive, I recommend applying the same logic to other relevant commands.

Specifically, consider adding -c core.autocrlf=false to:

  • The git checkout command within the update_ref function.
  • The git submodule update command within the update_submodules function.

Move the core.autocrlf=false setting into the git_cmd! macro so it
applies to all git operations (checkout, submodule update, etc.),
not just clone.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx
Copy link
Copy Markdown
Owner Author

jdx commented Jan 30, 2026

Addressed the feedback - moved the core.autocrlf=false setting into the git_cmd! macro so it applies to all git operations (checkout, submodule update, fetch, etc.), not just clone.

@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.9 x -- echo 19.9 ± 0.3 19.3 20.8 1.01 ± 0.03
mise x -- echo 19.7 ± 0.4 19.0 22.6 1.00

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.9 env 19.2 ± 0.8 18.4 28.6 1.00
mise env 19.4 ± 0.6 18.5 21.0 1.01 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.9 hook-env 19.4 ± 0.3 18.6 21.4 1.00
mise hook-env 20.0 ± 0.5 19.1 22.8 1.03 ± 0.03

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.9 ls 16.7 ± 0.3 16.2 18.1 1.00
mise ls 18.3 ± 0.6 17.3 22.8 1.09 ± 0.04

xtasks/test/perf

Command mise-2026.1.9 mise Variance
install (cached) 108ms 112ms -3%
ls (cached) 66ms 71ms -7%
bin-paths (cached) 70ms 74ms -5%
task-ls (cached) 285ms ⚠️ 539ms -47%

⚠️ Warning: task-ls cached performance variance is -47%

@jdx jdx merged commit c9baa7e into main Jan 31, 2026
35 checks passed
@jdx jdx deleted the fix/git-clone-crlf branch January 31, 2026 00:09
mise-en-dev added a commit that referenced this pull request Jan 31, 2026
### 🐛 Bug Fixes

- **(task)** resolve monorepo task includes relative to config file
directory by @jdx in [#7917](#7917)
- disable autocrlf on git clone to fix WSL issues by @jdx in
[#7916](#7916)

### 📚 Documentation

- **(tasks)** add bash array pattern for variadic args by @jdx in
[#7914](#7914)
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
## Summary
- Adds `-c core.autocrlf=false` to git clone commands to prevent CRLF
line ending conversion

## Problem
On WSL, git may be configured with `core.autocrlf=true` (Windows
default), which converts LF to CRLF line endings when cloning
repositories. This causes shell scripts (like ruby-build's `install.sh`)
to fail with errors like:

```
: not found 5: 
install.sh: 6: set: Illegal option -
```

The carriage returns (`\r`) are interpreted as part of commands, causing
the shell to fail.

## Solution
Pass `-c core.autocrlf=false` to the git clone command to ensure line
endings are not converted, regardless of the user's global git
configuration.

## Test plan
- [x] Linting passes
- [ ] Test on WSL with `core.autocrlf=true` set globally

Fixes jdx#7913

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this only forces `core.autocrlf=false` on the project’s
`git` subprocesses to prevent CRLF conversion issues (notably on WSL),
without changing repository selection or network behavior.
> 
> **Overview**
> Forces `core.autocrlf=false` on all `git` subprocess invocations via
the `git_cmd!` macro, ensuring checkouts/updates don’t convert LF to
CRLF based on a user’s global Git config.
> 
> Also passes the same config explicitly to `git clone` (via
`CmdLineRunner`) so newly cloned repos keep LF line endings and avoid
script failures on environments like WSL.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
54c77d8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
### 🐛 Bug Fixes

- **(task)** resolve monorepo task includes relative to config file
directory by @jdx in [jdx#7917](jdx#7917)
- disable autocrlf on git clone to fix WSL issues by @jdx in
[jdx#7916](jdx#7916)

### 📚 Documentation

- **(tasks)** add bash array pattern for variadic args by @jdx in
[jdx#7914](jdx#7914)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants