visual-studiovisual-studio-2017gitignoregit-commitgit-repo

Error while i try to commit changes in Git via Visual studio 2017


I`m trying to commit to my DevOps using Git source. for some reason I cannot proceed with the commit phase.

The error:

Git failed with a fatal error.
error: open("FinalWorkFinder/FinalWorkFinder/App_Data/aspnet-FinalWorkFinder-20190303122718.mdf"): Permission denied
fatal: Unable to process path FinalWorkFinder/FinalWorkFinder/App_Data/aspnet-FinalWorkFinder-20190303122718.mdf

If I go to repository settings, I can see that there is already a .gitignore file, but it does not ignore .mdf.

What should I do?


Solution

  • First, try and double-check that status from the command-line:

    git status
    

    If the file is ignored and yet still tracked, do:

    git rm --cached -- FinalWorkFinder/FinalWorkFinder/App_Data/aspnet-FinalWorkFinder-20190303122718.mdf
    

    Make sure it is actually ignored with:

    git check-ignore -v -- FinalWorkFinder/FinalWorkFinder/App_Data/aspnet-FinalWorkFinder-20190303122718.mdf
    

    Followed by a git commit: see if the issue persists for future commits.