看起来我的 .gitignore 文件不像预期的那样正确。
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: .gitignore
new file: win_2016_datacentre_vm/.terraform/plugins/linux_amd64/lock.json
new file: win_2016_datacentre_vm/.terraform/plugins/linux_amd64/terraform-provider-azurerm_v1.16.0_x4
new file: win_2016_datacentre_vm/aos-1.tfvars
new file: win_2016_datacentre_vm/aos-1.v1/.terraform/plugins/linux_amd64/lock.json
new file: win_2016_datacentre_vm/aos-1.v1/.terraform/plugins/linux_amd64/terraform-provider-azurerm_v1.16.0_x4
new file: win_2016_datacentre_vm/aos-1.v1/aos-1.plan
new file: win_2016_datacentre_vm/aos-1.v1/aos-1.tf
new file: win_2016_datacentre_vm/aos-1.v1/aos-1.tfvars
new file: win_2016_datacentre_vm/aos-1.v1/terraform.tfstate
new file: win_2016_datacentre_vm/aos-1.v1/terraform.tfstate.backup
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
$ cat .gitignore
# Local terraform directories
docker/*
terraform-getting-started/*
terraform-getting-started.zip
**/.terraform/**
*/**/.tfvars
*.tfstate
让我感到惊奇的是,尽管我已经添加了 .terraform、*.tfvars 和 *.tfstate,为什么还会在 git status 中报告它们?
另外,我应该将 tfstate 提交到存储库中吗?
非常感谢您的帮助。
谢谢