.gitignore文件不忽略.env.local或任何其他假定的私人文件
我遇到了此错误,因为我曾经错误地犯下.env.local
,然后将其添加到.gitignore
。下面的答案。
I encountered this error because I once mistakenly committed .env.local
before adding it to .gitignore
. The answer to it below.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您面对类似的内容,并且在VSCODE中使用GIT GUI,请按照以下步骤:
.env.local
文件或任何有此问题的文件,请将内容复制到剪贴板,然后完全删除文件。.gitignore
文件,然后删除删除该文件的行。.env.local
file(或您在案例中之前删除的文件。).gitignore
现在,将其忽略。
If you're facing something similar and you use the Git GUI in VSCode, just follow these steps:
.env.local
file or any file that's having this issue, copy the content to clipboard, and delete the file entirely..gitignore
file and delete the line that removes that file..env.local
file (or the file you deleted earlier in your case.).gitignore
Now, it will be ignored for real.