0

I am trying to exclude Pipfile and Pipfile.lock by adding two lines in my .gitignore file. But they are not being omitted when they are pushed to git. Can someone please let me know why.

My .gitignore looks like this

Pipfile
Pipfile.lock
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Gopi B
  • 21
  • 6
  • No idea but are you sure you want to exclude your Pipfile? – Kent Shikama Dec 07 '19 at 08:24
  • Actually, have you staged your `.gitignore` file? – Kent Shikama Dec 07 '19 at 08:24
  • I am using a GitHub desktop app to push all commits . I added a . gitignore just to see if it will exclude pip files. The .gitignore is there in the GitHub repository, but it didn't exclude the two files mentioned in it – Gopi B Dec 07 '19 at 08:27

1 Answers1

1

.gitignore has no effect whatsoever on what will be pushed. What will be pushed is whatever is on the revisions you are pushing. So if the files are already part of some of those revisions (in other words, they are already tracked), adding lines in .girignore won't make a difference. If you want them to be gone from those revisions then you will have to rewrite history. How to remove file from Git history?

eftshift0
  • 26,375
  • 3
  • 36
  • 60