How to create a .gitignore file in Windows

Windows 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

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

Other related posts:
* Git Delete a Local or Remote Branch
* How to Clone a Git Repository into a Specific Folder?
* Change the URI for a Remote Git Repository
* How to Merge a Local Git Branch with Master
* How to Setup Aliases and Shortcuts for Git Commands

This content has been helpful to you?

Thanks for contributing!

Yes No