0

Extract of ".gitignore" file

/Api/bin/log4net.dll
/Web/bin/log4net.dll
/Api/bin/System.Web.Http.dll
/Api/bin/System.Net.Http.Formatting.dll
/packages

When I try to commit :

enter image description here

Question : How to get rid of these repackage files when I try to commit (.gitignore is in root )?

Sampath
  • 63,341
  • 64
  • 307
  • 441
  • 2
    possible duplicate of [Ignore files that have already been committed to a Git repository](http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository) – ChrisGPT was on strike Sep 17 '14 at 18:15

3 Answers3

1

Step 1 : Firstly commit any outstanding code changes into your local master.

Type below commands on Git Bash.

Step 2 : Move into your local repository directory (The root where your .gitignore file resides).

cd "D:\Freelance Work\My Mvc Project"

Step 3 :

git rm -r --cached .

This removes any changed files from the index(staging area).

Step 4 :

git add .

Step 5 : Commit it.

git commit -m ".gitignore is now working"
Sampath
  • 63,341
  • 64
  • 307
  • 441
0

You might have those files committed before you add the lines in gitignore.

If that's the case, you have to remove them from tracking.

If you are using windows, cd to the path of your local git. For example if your git repo folder is in c:\project\projectA, you should type

cd /c/project/projectA

Then you have to untrack those file one by one by the below command:

git rm Api/bin/log4net.dll

After you remove them all, you have to commit.

palazzo train
  • 3,229
  • 1
  • 19
  • 40
-2

If the files were already checked in, then you need to remove them before git will start ignoring them. See if the files are listed when you run git ls-files. If they are, then see the SO answer that has been suggested as a possible duplicate of your question

Community
  • 1
  • 1
Isaac Betesh
  • 2,935
  • 28
  • 37