繁体   English   中英

.gitignore文件在git push期间不忽略某些文件?

[英].gitignore files not ignoring certain files during git push?

项目目录中我的.gitignore文件的内容:

bin/
.settings/
.classpath
.project
MyGuide.txt
.gitignore

我的github项目中显示了什么:

在此处输入图片说明

当我推送到我的远程仓库时,是否仍然会显示“ MyGuide.txt”和.gitignore文件?

看来您的文件已添加到git repo中。

一旦添加了文件(未取消跟踪),将其添加到.gitignore便不会忽略它,因为该文件已经在存储库中,因此您必须其从存储库中删除,提交文件的删除操作,然后它将被忽略。

# Remove any file you have already commited and you wish to ignore
git rm -rf --cached .idea/*

# now add the ignored pattern to your .gitignore file
git add -A .

# commit and push the removal of the ignored files.
git commit -m "Removed idea files"
git push

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM