git 存储库忽略所有 .dll
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15515729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git repository ignoring all .dlls
提问by Paul Knopf
Title says it all. I am trying to add my NuGet packages to the repository. Everything but the .dll files are being detected.
标题说明了一切。我正在尝试将我的 NuGet 包添加到存储库。正在检测除 .dll 文件之外的所有内容。
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.
gitignore 文件不包含对 *.dll 的引用。.dll 文件位于整个存储库中的任何位置时都不会被识别。info/exclude 也是空的。
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?
我可以手动添加 .dll 文件,但应该对其进行跟踪。为什么他们没有被追踪?
回答by Stuart M
Do you have either ~/.gitignore_global
or ~/.gitignore
in your home directory which could also be listing these file patterns?
你有两种~/.gitignore_global
或者~/.gitignore
其中也可以列出这些文件模式你的home目录?
回答by KevinB
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.
如果您使用 SourceTree 和默认设置,它将默认忽略所有 DLL... Tools=>Options=>Git 然后“编辑文件”...在.dll => "#.dll"之前添加一个 "# " .. 。 保存并关闭。
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.
然后在你的包文件夹中的 Windows 资源管理器中打开一个 GitBash 终端并输入“git add”。让它工作,回到 SourceTree 稍等片刻,所有那些丢失的包 DLL 都会显示出来供您提交和推送。
回答by meagar
I could add the .dll files manually, but they should be tracked. Why are they not being tracked?
我可以手动添加 .dll 文件,但应该对其进行跟踪。为什么他们没有被追踪?
No, they shouldn'tbe 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 tellyou why it's ignoring them, and prompt you to use git add -f
to add the file anyways.
尝试通过手动添加其中之一,git add
它会告诉您为什么忽略它们,并提示您git add -f
无论如何都要使用添加文件。
回答by Tuxdude
You need to explicitly tell git to track any new files.
您需要明确告诉 git 跟踪任何新文件。
Run
git add filename
to add the file to git's index.Run
git commit
to commit changes in your index.
运行
git add filename
将文件添加到 git 的索引。运行
git commit
以提交索引中的更改。
git status
should also show the list of untracked files and directories.
git status
还应显示未跟踪文件和目录的列表。
If you want to list all the files in the repo which are ignored by gitignore, you can run:
如果要列出 gitignore 忽略的 repo 中的所有文件,可以运行:
git ls-files . --ignored --exclude-standard --others
If you want to list all the untracked files in the repo:
如果要列出 repo 中所有未跟踪的文件:
git ls-files . --exclude-standard --others
回答by Niraj Trivedi
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.
我遇到了类似的问题。我无法将 .dll 文件从包目录添加到我的 git 然后我发现 gitignore_global.txt 文件因为 sourcetree 自动将此文件添加为全局 git 忽略设置。我从 gitignore_global.txt 文件中删除了 *.dll 并且它对我来说工作正常。
Location of gitignore_global.txt file as below
gitignore_global.txt 文件的位置如下
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
C:\Users\XXXX\Documents\gitignore_global.txt 或者您可以从 sourcetree TOOL => OPTION => GIT 选项卡中找到它并找出全局忽略列表
回答by Curtis
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...
就我而言,.gitignore 文件中没有 .dll 引用,也没有全局文件。但是,在 .git 子目录中,我找到了一个名为 ms-persist.xml 的文件。我关闭了 Visual Studio 的所有实例,然后手动将丢失的 .dll 添加到该文件中。当我重新打开 Visual Studio 时,.dll 显示为需要签入。我签入了它们,现在我很金...
回答by Lorenz Lo Sauer
You have a global .gitignore
somewhere or further .gitignore
files in subdirectories - relative to your project's root.
您在.gitignore
某个地方或.gitignore
子目录中有一个全局文件 - 相对于您的项目的根目录。
On Linux Systems and MacOS the global git-ignore is most likely in your Home ~/
在 Linux 系统和 MacOS 上,全局 git-ignore 最有可能在您的家中 ~/
~/.gitignore_global
~/.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.
在 Windows 上,它可能在您的用户目录中。您的本地用户(您可以通过键入ECHO %USERPROFILE%
或whoami
在命令行中找到。
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).
如果它不存在,那么肯定.gitconfig
存在a 。在此处查找 gitignore 的位置(例如用户Documents
文件夹)。
Edit:
Use git config --list --show-origin
to get details of the contributing git-settings and their corresponding file locations.
编辑:git config --list --show-origin
用于获取贡献的 git 设置及其相应文件位置的详细信息。