If you're using Windows it will not let you create a file without a filename in Windows Explorer.
(如果您使用的是Windows,则不允许您在Windows资源管理器中创建没有文件名的文件。)
It will give you the error " You must type a file name " if you try to rename a text file as .gitignore (如果您尝试将文本文件重命名为.gitignore ,它将显示错误“ 您必须键入文件名 ”)
![在此输入图像描述](https://stackoom.com/link/aHR0cHM6Ly9pLmltZ3VyLmNvbS9XMEo2T3J0LnBuZw==)
To get around this I used the following steps
(为了解决这个问题,我使用了以下步骤)
- Create the text file gitignore.txt
(创建文本文件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
(按住SHIFT键,右键单击您所在的文件夹,然后在此处选择“ 打开命令窗口”)
- Then rename the file in the command line, with
ren gitignore.txt .gitignore
(然后使用ren gitignore.txt .gitignore
在命令行中重命名该文件)
Alternatively @HenningCash suggests in the comments
(或者@HenningCash在评论中建议)
You can get around this Windows Explorer error by appending a dot to the filename without extension: .gitignore.
(您可以通过在没有扩展名的文件名后附加一个点来解决此Windows资源管理器错误:.gitignore。)
will be automatically changed to .gitignore (将自动更改为.gitignore)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…