Checksum Mismatch between Different Environments
Question
When using Atlas on my macOS
, I can run atlas migrate apply
without any issues, and it applies the migrations successfully.
But when running in CI on linux
, I get the following error: Error: checksum mismatch
Answer
This issue is likely due to differences in line endings between operating systems. macOS
uses LF
(Line Feed) for line endings,
while Windows
uses CRLF
(Carriage Return + Line Feed). When you run Atlas commands in a Docker container,
it may be using a different line ending format than what your migrations were created with.
To resolve this issue, you can try the following steps:
- Add a
.gitattributes
file to your repository with the following content:
# Ensure all text files use LF line endings
* text=auto eol=lf
- Commit the
.gitattributes
file to your repository. - If you have existing migration files that were created with different line endings, you may need to normalize them. You can do this by running the following command in your repository:
# Remove all files from the index (but keep them on disk)
git rm --cached -r .
# Re-checkout the files from the repository
git reset --hard