简体   繁体   English

克隆时Git更改二进制文件

[英]Git altering binary files when cloning

I'm just getting started with git and am running into a problem when attempting to clone a respository from github. 我刚开始使用git,尝试从github克隆存储库时遇到问题。 There are several binary files (.exe and .dll) contained in the repo; 存储库中包含几个二进制文件(.exe和.dll)。 when I make a clone of this on my local machine none of these binaries are valid (as far as windows is concerned). 当我在本地计算机上对此进行克隆时,这些二进制文件都不有效(就Windows而言)。 Attempting to execute them results in the following message being displayed: 尝试执行它们会导致显示以下消息:

'XXX is not a valid Win32 application' “ XXX不是有效的Win32应用程序”

I believe I have everything setup properly, (using GitExtensions, if that's relevant) - but I can't seem to get this issue resolved. 相信我已经正确设置了所有设置(如果相关,请使用GitExtensions)-但我似乎无法解决此问题。

Any help much appreciated! 任何帮助,不胜感激!

Edit: 编辑:

This is my current .gitconfig - if relevant: 这是我当前的.gitconfig-如果相关:

[merge]
    tool = kdiff3
[mergetool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe
[diff]
    guitool = kdiff3
[difftool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe
[core]
    editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor
    autocrlf = true

You may have fallen foul of line endings fix up's - and it not treating the files as binary: 您可能犯了行尾修正错误,并且没有将文件视为二进制文件:

For example, if you want all *.foo files to be treated as binary files you can have this line in .gitattributes: 例如,如果要将所有* .foo文件都视为二进制文件,则可以在.gitattributes中包含以下行:

*.foo -crlf -diff -merge 

This will mean all files with a .foo extension will not have carriage return/line feed translations done, won't be diffed and merges will result in conflicts leaving the original file untouched. 这意味着所有带有.foo扩展名的文件都不会完成回车/换行的翻译,不会造成差异,并且合并将导致冲突,而原始文件将保持不变。

Source info: About the line endings: http://help.github.com/dealing-with-lineendings/ 源信息:关于行结尾: http : //help.github.com/dealing-with-lineendings/

About Binary files: http://www.bluishcoder.co.nz/2007/09/git-binary-files-and-cherry-picking.html . 关于二进制文件: http : //www.bluishcoder.co.nz/2007/09/git-binary-files-and-cherry-picking.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM