1

When we pull a revision from Github than it is not ignoring the files and directories which are placed in .gitignore file. It is pulling all the files and directories. How to resolve this issue? I need to ignore some files and directories when pulling from github.

This is how my current .gitignore file looks like -

  • /vendor
  • /node_modules
  • Homestead.yaml
  • Homestead.json
  • .env
  • .idea/workspace.xml
  • /config/test
  • /storage/logs/laravel.log

1 Answers1

2

I suspect what is happening is, the files you are trying to ignore using .gitignore were previously tracked (before ignore statements were added).

So to make the repository forget the files in git ignore look at this answer here:

How to make Git "forget" about a file that was tracked but is now in .gitignore?

That being said, if you actually "mean" exactly what you have written in your question, that suggests your understanding of how .gitignore works is flawed.

.gitignore does not prevent the files from being pulled down from the repository. It prevents them from getting committed to a repository in the first place.

Community
  • 1
  • 1
Shaunak
  • 17,377
  • 5
  • 53
  • 84
  • I am using AWS Code Deploy Service for this. So do I need to make changes on EC2 instance before pulling from github. AWS Codedeploy agent will not take care of this. –  Sep 23 '15 at 05:45
  • 1
    no, you don't need to make changes to EC2. You need to get rid of ignored stuff from the main repository (github?). To do that follow the instructions in the link in the answer. If you don't want those things to be gone from actually repository, but don't want to check them out on EC2, only way to do that is to create a branch or a 'distribution' folder in your repository , and clone that on EC2 – Shaunak Sep 23 '15 at 05:54