When I run a notebook in a devcontainer, I get the following problem:

Every file is shown as modified, and the diff shows that every line has been changed from LF to CRLF.

MindYourEndOfLine is a good article on the topic.

GitHub Advice is also useful.

It is generally agreed that repositories should use LF, not CRLF. This is because CRLF is a Windows convention, and LF is a Linux convention. If you use CRLF, then you will have problems when you try to run your code on a Linux machine. If you develop on a mix of Linux and Windows machines (such as linux devcontainers on Windows), then you may have problems with CRLF.

It is possible to use Git configuration settings (see next section) to control how line endings are handled. However, this assumes that all developers consistently define their settings. Instead, it is best to define how end of line is handled by using the per-repository .gitattributes file, which is the “new way” of handling end of line configuration, and will supersede other settings.

The .gitattributes file is committed to the repository and will therefore be used consistently for all users, assuming that client software recognizes the attributes. The following is the recommended setting in the .gitattributes file:

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Also can define which files are text and binary, to help Git make the right decision
*.md   text
*.png  binary

The person that sets up a repository initially should include an appropriate .gitattributes file in the root folder of the working files.

In windows, you can set the following global configuration settings:

git config --global core.eol lf

Configure Git to ensure line endings in files you add are correct for Linux

Happy CRLFing,

Brian

Lovell Portrait