git repository ignoring all .dlls

GitGitignore

Git Problem Overview


Title says it all. I am trying to add my NuGet packages to the repository. Everything but the .dll files are being detected.

The gitignore file contains no references to *.dll. The .dll files don't get recognized when located anywhere in the entire repository. info/exclude is also empty.

I have also cloned the repository (file-system to file-system as opposed from remote to file-sysytem) with no luck. This issue also happens on two different computers.

I could add the .dll files manually, but they should be tracked. Why are they not being tracked?

Git Solutions


Solution 1 - Git

Do you have either ~/.gitignore_global or ~/.gitignore in your home directory which could also be listing these file patterns?

See https://help.github.com/articles/ignoring-files

Solution 2 - Git

If you use SourceTree and the default setting it will ignore all DLLs by default... Tools=>Options=>Git then "Edit File"... add a "#" before .dll => "#.dll" ... save and close.

Then for Windows Explorer in your packages folder in open a GitBash terminal and type "git add ." and let it work, back into SourceTree wait a second and all those missing package DLLs will show up for you to commit and push.

Solution 3 - Git

> I could add the .dll files manually, but they should be tracked. Why are they not being tracked?

No, they shouldn't be tracked, unless you've added them. Only files which are already added and committed are tracked; that's what "tracked" means.

Try manually adding one of them via git add and it will tell you why it's ignoring them, and prompt you to use git add -f to add the file anyways.

Solution 4 - Git

You need to explicitly tell git to track any new files.

  1. Run git add filename to add the file to git's index.

  2. Run git commit to commit changes in your index.

git status should also show the list of untracked files and directories.

If you want to list all the files in the repo which are ignored by gitignore, you can run:

git ls-files . --ignored --exclude-standard --others

If you want to list all the untracked files in the repo:

git ls-files . --exclude-standard --others

Solution 5 - Git

I faced a similar issue. I am unable to add .dll file from package directory to my git then i found gitignore_global.txt file as sourcetree automatically added this file as a global git ignore setting. I removed *.dll from gitignore_global.txt file and its work fine for me.

Location of gitignore_global.txt file as below

C:\Users\XXXX\Documents\gitignore_global.txt or you can find it out from sourcetree TOOL => OPTION => GIT tab and find out global ignore list

Solution 6 - Git

In my case, there were no .dll references in the .gitignore file, and I had no global file. However, in the .git subdirectory, I found a file called ms-persist.xml. I closed all instances of Visual Studio, and then added my missing .dlls manually to that file. When I re-opened visual studio, the .dlls were showing as needing to be checked in. I checked them in and now I'm golden...

Solution 7 - Git

You have a global .gitignore somewhere or further .gitignore files in subdirectories - relative to your project's root.

On Linux Systems and MacOS the global git-ignore is most likely in your Home ~/

~/.gitignore_global

On Windows it is likely in your User Directory. Either your local user (which you can find out by typing in ECHO %USERPROFILE% or whoami at the command-line.

If it is not there, then surely a .gitconfig is present instead. Look herein for the location of the gitignore (e.g. the User's Documents folder).

Edit: Use git config --list --show-origin to get details of the contributing git-settings and their corresponding file locations.

Solution 8 - Git

I know this question is very old, but I'm adding for others who may visit this question in the future. You can go modify your global ignore file as the answers above mentioned, but that will affect ALL of your git repos. If, instead, you'd like a more granular approach, you can just exclude either specific DLLs or specific folders in your individual project .gitignores. This overrides the all ignore settings and forces the files to be detected and handled by git. I think this is a better approach.

.gitignore (for your particular project)

# Custom ignores
!*.dll
# or
!My.specific.dll

# rest of .gitignore

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPaul KnopfView Question on Stackoverflow
Solution 1 - GitStuart MView Answer on Stackoverflow
Solution 2 - GitKevinBView Answer on Stackoverflow
Solution 3 - Gituser229044View Answer on Stackoverflow
Solution 4 - GitTuxdudeView Answer on Stackoverflow
Solution 5 - GitNiraj TrivediView Answer on Stackoverflow
Solution 6 - GitCurtisView Answer on Stackoverflow
Solution 7 - GitLorenz Lo SauerView Answer on Stackoverflow
Solution 8 - Gitjp36View Answer on Stackoverflow