0
ubuntu@ip-172-31-100-164:/etc/ansible/roles$ cat .gitignore
# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
#     https://www.atlassian.com/git/tutorials/saving-changes/gitignore
*.swp
*xcore/vars/.main.yml.swp
git status 
    modified:   .gitignore
    modified:   argo_setup.yml
    modified:   xcore/tasks/argocd_apps.yml
    deleted:    xcore/vars/.main.yml.swp
    modified:   xcore/vars/main.yml

I want to ignore above file please help me!

matt
  • 515,959
  • 87
  • 875
  • 1,141
Haridvpsk
  • 91
  • 1
  • 11

1 Answers1

1
deleted:    xcore/vars/.main.yml.swp

That means it was tracked, and is staged for deletion in the next commit

Try instead:

git reset xcore/vars/.main.yml.swp
git rm --cached xcore/vars/.main.yml.swp

Then check if it is ignored with:

git check-ignore -v -- xcore/vars/.main.yml.swp
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250