windows git 无法识别 exe 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22265536/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 11:26:41  来源:igfitidea点击:

git does not recognize exe file

windowsgitgithubatlassian-sourcetreegithub-for-windows

提问by Youngjae

I'd like to upload NuGet.exeto github but all exe files are not listed to my local repository.

我想将NuGet.exe上传到 github,但所有 exe 文件都没有在我的本地存储库中列出。

I did upload NuGet.exefile about two weeks ago at another project repo, but now I cannot upload any exe file at all. There is no global .gitignorethat I specially defined.

NuGet.exe大约两周前,我确实在另一个项目仓库上传了文件,但现在我根本无法上传任何 exe 文件。没有.gitignore我特别定义的全局。

below code is my .gitignorefile. what am I missing?

下面的代码是我的.gitignore文件。我错过了什么?

# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder 
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
packages

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

# Windows-specific files
Thumbs.db
desktop.ini
# Mac-specific things (thanks to Michael Aaron Safyan)
.DS_Store

-- EDIT --

- 编辑 -

same files under .nuget/directory .configand .targetsfiles are well treated. I can check git ls-files --others -i --exclude-standardgives NuGet.exeis ignored, but I don't know which rule makes it.

.nuget/目录.config和文件下的相同文件.targets得到很好的处理。我可以检查git ls-files --others -i --exclude-standard给予NuGet.exe被忽略,但我不知道哪个规则使它。

回答by VonC

First, you can check if a file is locally ignored ion your repo with git check-ignore:

首先,您可以使用以下命令检查文件是否在您的存储库中被本地忽略git check-ignore

git check-ignore -v -- yourFile

Second, you can force to add that file (bypassing any ignore rule):

其次,您可以强制添加该文件(绕过任何忽略规则):

git add -f yourFile

回答by Oswaldo Alvarez

I just put !NuGet.exeat first in .gitignorefile and work perfect for me

我只是把!NuGet.exe第一个放在.gitignore文件中,对我来说很完美

回答by DragonSpit

I used TortoiseGit in Windows using Windows UI, navigated to the folder, right-clicked and added the .exe files directly. These added files showed up in SourceTree and I committed them from there.

我使用 Windows UI 在 Windows 中使用 TortoiseGit,导航到文件夹,右键单击并直接添加 .exe 文件。这些添加的文件出现在 SourceTree 中,我从那里提交了它们。