If you are using visual studio or something similar that is generating the mdf file, simply close VS & retry your git command again. This time it should work.
To save constantly closing & reopening, you should add references into .gitignore file in the project root. For example, if it is a database causing the issue, add the following:
# SQL Server files
*.mdf
*.ldf