I have a brand-new local git project that I have just cloned. I have not made any changes to the code, but when I run terraform init
I get the following error, repeated for every module in the project:
Downloading git::https://<gitlab address> for <module name>...
Error: Failed to download module
Could not download module " <module name>"
(<filename>.tf:<line #>) source code from
"git::<gitlab address>":
error downloading
'<gitlab address>':
C:\Program Files\Git\cmd\git.exe exited with 1: error: Your local changes to
the following files would be overwritten by checkout:
README.md
Please commit your changes or stash them before you switch branches.
Aborting
Every module download fails on the same file: README.md
. Again, I have made no changes to any files in the project.
My initial thought was that this might be related to a line-endling issue: I am using Windows, and the module files in the remote repository were created on a Mac. To address this, I ran the command git config --global core.autocrlf true
(following the recommendations here
I then deleted the .terraform folder and re-ran terraform init
, but got the same set of errors.
It’s possible this is purely a git issue, unrelated to terraform, but I have not been able to find any information on possible causes in the git forums, so I thought I’d try here.