Skip to content

Conversation

@madebygps
Copy link
Collaborator

I was testing out our repo on Windows in a devcontainer and azd up failed with /bin/sh: 1: ./infra/auth_init.sh: not found, even though the file existed.

Windows Git defaults to converting line endings to CRLF (users can disable this, some don't, like me), which breaks shell scripts in the devcontainer.

Added a .gitattributes file to enforce correct line endings per-repo, so it works for everyone automatically.

Copy link
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 adds a .gitattributes file to enforce consistent line endings across platforms, specifically to prevent Windows Git's default CRLF conversion from breaking shell scripts that run in Linux devcontainers. The fix addresses the immediate issue where auth_init.sh failed to execute in a Windows devcontainer due to incorrect line endings.

Key Changes:

  • Added .gitattributes with text=auto for automatic text file detection and LF normalization
  • Configured LF line endings for shell scripts, Python files, Dockerfiles, and configuration files used in Linux containers
  • Configured CRLF line endings for Windows-specific scripts (.bat, .cmd, .ps1)
  • Marked binary file types appropriately

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


# Shell scripts must use LF (they run in Linux containers/devcontainers)
*.sh text eol=lf
entrypoint.sh text eol=lf
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

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

The pattern 'entrypoint.sh' is redundant since line 5 already covers all '*.sh' files, which includes 'entrypoint.sh'. This redundant rule should be removed to keep the configuration cleaner and avoid confusion.

Copilot uses AI. Check for mistakes.
@pamelafox
Copy link
Contributor

@pamelafox pamelafox merged commit cc4f46f into Azure-Samples:main Dec 16, 2025
8 checks passed
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