If you right click in Windows and try to make a new text file with a . period/dot in front of it:
如果在Windows中单击鼠标右键,然后尝试使用创建一个新的文本文件。 前面的句点/点:
![image image](https://i-blog.csdnimg.cn/blog_migrate/2625d661495efedd77b84dc6405064b2.png)
Name the file...something like .gitignore, for example.
命名文件...例如,类似.gitignore的文件。
![image image](https://i-blog.csdnimg.cn/blog_migrate/99c787e78c50af8dd69700bf0ffe1059.png)
You'll get the "You must type a file name" error.
您将收到“您必须输入文件名”错误。
![image image](https://i-blog.csdnimg.cn/blog_migrate/9345d930ea92edc14b0c93e6c242be79.png)
But, rather than typing .gitignore, if you include an ending dot also, like
但是,如果您还包括一个结束点,则不要键入.gitignore,例如
.gitignore.
.gitignore。
Then it works fine.
然后工作正常。
![image image](https://i-blog.csdnimg.cn/blog_migrate/c6c80f1ddbb315f787d8728eba89a493.png)
Thanks, Mads, for the tip!
谢谢, Mads ,给小费!
NOTE: We're assuming that you have "File name extensions" turned on, because if you don't, you're likely not a programmer. ;)
注意:我们假设您已打开“文件扩展名”,因为如果没有,则可能不是程序员。 ;)
![image image](https://i-blog.csdnimg.cn/blog_migrate/3f1221f4cd899a20723aa19395eb14db.png)
UPDATED: Mads has created an "Add Empty File" Extension for VS that makes it easy to create . files as well!
更新: Mads为VS创建了一个“添加空文件”扩展名,使创建起来很容易。 文件也一样!
翻译自: https://www.hanselman.com/blog/how-to-create-a-file-with-a-dot-prefix-in-windows-explorer