.gitignore不起作用:应该忽略的文件仍然被提交 [英] .gitignore not working: files that should be ignored still get committed

查看:67
本文介绍了.gitignore不起作用:应该忽略的文件仍然被提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从现有文件夹创建一个新的git存储库.我已经在文件夹的根目录中创建了一个.gitignore文件.但是如果我说

I'm trying to create a new git repository from existing folder. I've created a .gitignore file in the root of the folder. But if I say

git add *
git commit
git push

应忽略的文件仍将提交到远程存储库.我在Windows上. 我还购买了SmartGIT的许可证.它似乎也忽略了.gitignore.我必须手动选择要提交的新文件.

files that should be ignored still get committed to the remote repository. I'm on Windows. Also I've bought a license for SmartGIT. It also seems to ignore .gitignore. I have to manually select which new files to commit.

推荐答案

您的文件仍必须跟踪,通过执行git status可以看到,即使文件位于.gitignore中,该文件也会被修改.
您需要这样做:

Your file must still be tracked, you can see by doing git status that will show you that your file is modified even if it's in .gitignore
You need to do this:

git update-index --assume-unchanged [path_to_file]

这篇关于.gitignore不起作用:应该忽略的文件仍然被提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆