天使漫步IT工作室天使漫步IT工作室

添加gitignore文件后使其生效


Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 110

Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 116

我们发现在添加.gitignore文件后,当我们想push文件的时候,我们声明的忽略文件还是会出现在push的目录中

原因分析

某些文件已经被纳入版本管理中(本地的缓存中),就算是在.gitignore中已经声明也不会起作用

解决方案

我们应该先把本地的缓存删除,然后再进行push,操作步骤如下

git rm -r --cached . // 删除本地缓存
git add . // 添加要提交的文件
git commit -m 'update .gitignore' // 更新本地的缓存

本站原创,欢迎转载,转载敬请标明出处:天使漫步IT工作室 » 添加gitignore文件后使其生效
已有 2 条评论
  1. 非技术的路过。

  2. 文章不错支持一下吧

添加新评论


Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /www/wwwroot/u11u.com/usr/themes/wq/comments.php on line 38