Select Page

.gitignore file sample

Adding files to .gitignore

All you need to do is create a file in the root of the project and name it .gitignore. Then open the file and add the list of files and directories, you want to add to the ignore list.

Ignoring individual files and folders

Ignoring specific formats


Creating .gitignore file on Windows

If you’re using Windows it will not let you create a file without a filename in Windows Explorer. It will give you the error “You must type a file name” if you try to rename a text file as .gitignore

To get around this use the following steps

  • Create the text file gitignore.txt
  • Open it in a text editor and add your rules, then save and close
  • Hold SHIFT, right click the folder you’re in, then select Open command window here
  • Then rename the file in the command line, with ren gitignore.txt .gitignore