Git新手求助:如何删除dist.tar文件并完成Git Push操作
Git新手问题解决方案:处理.DS_Store与删除dist.tar
一、删除dist.tar并清除Git追踪提示
- 删除本地的dist.tar文件,执行命令:
rm dist.tar - 执行
git status检查,此时应该不会再看到dist.tar出现在Untracked files列表里了。
二、永久解决.DS_Store自动出现的问题
Mac系统的.DS_Store是自动生成的隐藏文件,你可以通过.gitignore让Git永远忽略它:
- 在项目根目录创建.gitignore文件(如果还没有的话):
touch .gitignore - 打开.gitignore文件,添加以下内容:
这样以后无论是.DS_Store还是dist.tar,Git都会自动忽略它们,不会再出现在追踪提示里。.DS_Store dist.tar - 将.gitignore文件提交到仓库:
git add .gitignore git commit -m "添加.gitignore,忽略.DS_Store和dist.tar"
三、提交并推送index.html到GitHub
- 将index.html加入Git追踪:
git add index.html - 提交更改:
git commit -m "提交index.html文件" - 推送到GitHub仓库:
git push
内容的提问来源于stack exchange,提问作者mcgcode
相关产品推荐
相关产品推荐

