问题描述
.DS_Store
node_modules
/dist
screen
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Vue browser Extension Output
*.pem
*.pub
*.zip
/artifacts
我正在尝试添加一条规则,告诉git忽略.jpeg
或.jpg
和.code-workspace
文件,但是当我推送存储库时,添加的规则将被忽略在线,并且这些文件仍会被复制。这种语法正确吗?
# Ignoring psd and image files
*.jpg
*.psd
# Ignoring VS workspace files
*.code-workspace
解决方法
.gitignore
中的语法看起来不错。
您的存储库怎么样:.jpg
和.jepg
文件是否被推送到存储库?如果文件已保留在存储库中(git push
已执行),则必须取消跟踪该文件。然后,在推送文件之后,Git将跟踪此添加的文件,并且所有跳过的匹配规则都将被跳过。
使用以下命令,您可以从存储库中删除文件,而无需实际删除:
git rm --cache folder/to/the/imagefiles
提交更改后,所有文件将从存储库中删除,并且忽略应该可以正常工作。
git rm文档。
,我怀疑您可能需要包括其他格式,请专门在此printf '*.jpg\n*.jpeg\n*.png\n*.gif\n' >> .gitignore
行中查看此link。
根据您的情况,您可以将其添加到.gitignore
*。jpg
* .jpeg
* .png
* .gif
* .tiff