Windows 版 Git - 程序无法启动,因为缺少 libiconv2.dll

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

Git for Windows - The Program can't start because libiconv2.dll is missing

gitmsysgit

提问by user413945

When I attempt to run certain commands (like git push, for example) from a git Bash on Windows 7 (64bit) I get the error:

当我尝试从 Windows 7(64 位)上的 git Bash 运行某些命令(例如 git push)时,出现错误:

The program can't start because libiconv2.dll is missing from your computer

I have searched exhaustively for a solution to this.
The most I can find is an issue thread at the google code site (Issue 419) and a few other blogs here and there. As far as I can tell none of the suggestions offered in the posts will actually solve my issue.

我已经详尽地寻找解决方案。
我能找到的最多的是 google 代码站点(问题 419)上的一个问题线程和其他一些博客。据我所知,帖子中提供的任何建议都不能真正解决我的问题。

I have tried re-installing. I have tried adding $GIT/binto the PATH.
I can verify that the dll is in the $GIT/bindirectory...but still I cannot push to remote.

我试过重新安装。我尝试添加$GIT/binPATH.
我可以验证 dll 是否在$GIT/bin目录中...但我仍然无法推送到远程。

I have a working install of msysgit on another Windows 7 box, and I installed the same way in both situations... so needless to say I am quite confused.

我在另一个 Windows 7 机器上安装了 msysgit,并且在两种情况下都以相同的方式安装......所以不用说我很困惑。

Any help on this would be most appreciated.

对此的任何帮助将不胜感激。

Thanks,

谢谢,

采纳答案by user413945

I have resolved this...there are a couple of things to note here.

我已经解决了这个问题……这里有几件事需要注意。

1) The problem was a typo in my configured origin in my local .git/config file...So I'm an idiot.

1)问题是我在本地 .git/config 文件中配置的原点中的一个错字......所以我是一个白痴。

2) Git Bash does not fail gracefully in this situation, and then throws this very misleading error as an alert, rather than reporting that there is no configured origin of the name specified in the .git/config file.

2) Git Bash 在这种情况下不会优雅地失败,然后抛出这个非常具有误导性的错误作为警报,而不是报告没有在 .git/config 文件中指定的名称的配置来源。

The only way I was able to figure this out was by adding the $GitPath/cmd directory to my path and running git from the command line. There, I was able to get a verbose error message indicating that the remote repository did not yet exists. Then I pulled up the trusty vi editor and saw there was in fact a typo.

我能够弄清楚这一点的唯一方法是将 $GitPath/cmd 目录添加到我的路径并从命令行运行 git。在那里,我能够收到一条详细的错误消息,指出远程存储库尚不存在。然后我打开了可靠的 vi 编辑器,发现实际上是一个错字。

The lesson here. If you are getting a weird .dll error with msysgit, it could very likely be the result of a misconfiguration...rather than some system anomaly or install issue.

这里的教训。如果您在使用 msysgit 时遇到奇怪的 .dll 错误,很可能是由于配置错误...而不是某些系统异常或安装问题。

Thanks to everyone who tried to help with this!

感谢所有试图帮助解决这个问题的人!

回答by paulecoyote

Work around from this thread: http://groups.google.com/forum/#!topic/msysgit/twrVn_EbNI4

从这个线程解决:http: //groups.google.com/forum/#!topic/msysgit/twrVn_EbNI4

  • cdinto your git install directory
  • copy mingw\bin\libiconv-2.dll libexec\git-core
    (or copy bin\libiconv-2.dll libexec\git-coreif your installation has no mingwfolder)
  • cd进入你的 git 安装目录
  • copy mingw\bin\libiconv-2.dll libexec\git-core
    (或者copy bin\libiconv-2.dll libexec\git-core如果您的安装没有mingw文件夹)

In the linked thread Drew asks for assistance, so if you think you can help fix it you might want to reply in that Google Groups thread.

在链接的线程中 Drew 寻求帮助,因此如果您认为可以帮助修复它,您可能希望在该 Google 网上论坛线程中回复。

Error happens with these builds:

这些构建发生错误:

  • msysgit-fullinstall-1.7.4 OR 1.7.6 (and 1.7.7)
  • msysgit-netinstall-1.7.4 OR 1.7.6 (and 1.7.7)
  • Git For Windows 1.7.6 (but not1.7.4)
  • msysgit-fullinstall-1.7.4 或 1.7.6(和 1.7.7)
  • msysgit-netinstall-1.7.4 或 1.7.6(和 1.7.7)
  • Git For Windows 1.7.6(但不是1.7.4)

回答by sqzaman

  • copy /Program Files/Git/bin/libiconv-2.dll
  • to /Program Files/Git/libexec/git-core/
  • 复制/Program Files/Git/bin/libiconv-2.dll
  • 到 /Program Files/Git/libexec/git-core/

回答by so_mv

I saw this error with msysGit-fullinstall-1.7.3.1-preview20101002.exe on Win 7.

我在 Win 7 上使用 msysGit-fullinstall-1.7.3.1-preview20101002.exe 看到了这个错误。

Added <msysgit_dir>\mingw\bin to PATH 

fix it. libiconv2.dll was found in that directory.

修理它。在该目录中找到了 libiconv2.dll。

回答by Cooler

Had this problem in SmartGit on mac. Fixed it by changing in Preferences -> Commands -> Executable

在 mac 上的 SmartGit 中遇到了这个问题。通过在Preferences -> Commands -> Executable 中更改来修复它

Git Executable:

Git 可执行文件:

from

/usr/bin/git

to:

到:

/usr/local/git/bin/git

回答by wytten

Variation of sqzaman's answer, as I did not have the folders in the same place they did:

sqzaman 的答案的变化,因为我没有在他们做的同一个地方的文件夹:

Copy
%USERPROFILE%\Local Settings\Application Data\GitHub\PortableGit_*\bin\*.dll
to
%USERPROFILE%\Local Settings\Application Data\GitHub\PortableGit_*\libexec\git-core

Note that I started by copying libiconv-2.dll, but then it complained about libcurl.dll so I went ahead and copied *.dll

请注意,我从复制 libiconv-2.dll 开始,但后来它抱怨 libcurl.dll,所以我继续复制 *.dll

回答by Erdin? ?orbac?

As SmartGit references this page of stackoverflow in error result i think this knowledge might be useful for someone here....

当 SmartGit 在错误结果中引用 stackoverflow 的这个页面时,我认为这些知识可能对这里的人有用....

Sometimes although there is no problem with git installation. Even if you can use git bash and get version information by typing

有时虽然git安装没有问题。即使您可以使用 git bash 并通过键入获取版本信息

git -- version 

SmartGit doesn't add repository and returns git is obsolote or version information is cannot be fetched (or similar to this message)...

SmartGit 不添加存储库并返回 git 已过时或无法获取版本信息(或类似于此消息)...

If so, you'd better check your security utilities and virus removal applications settings first. In my situation disabling comodo firewall make smartgit able to see healty git installation and version information.

如果是这样,您最好先检查您的安全实用程序和病毒清除应用程序设置。在我的情况下,禁用 comodo 防火墙使 smartgit 能够看到健康的 git 安装和版本信息。

回答by Erdin? ?orbac?

I just tried installing SmartGIT on Windows and facing the same problem. I just figure out that it works not by pointing it to git.exe, instead I pointed it to C:\msysgit\cmd\git.cmd. So far it works just fine. I can access the git repository under msysgit.

我只是尝试在 Windows 上安装 SmartGIT 并面临同样的问题。我只是发现它不是通过将它指向 git.exe 来工作的,而是将它指向 C:\msysgit\cmd\git.cmd。到目前为止它工作得很好。我可以在 msysgit 下访问 git 存储库。

FYI, I'm using the Net installer for Windows.

仅供参考,我使用的是 Windows 的网络安装程序。

Hoping that this is the right approach.

希望这是正确的方法。

回答by sompylasar

My answer resolves the same error for msysgit, but may help with pure git.

我的回答解决了 msysgit 的相同错误,但可能对纯 git 有所帮助。

On Windows 7, I added <msysgit_dir>\mingw\binto PATHas so_mv has recommended above(via the System Variables GUI), but I had to logout and login to OS after that, otherwise the PATHvalue won't get updated.

在 Windows 7 上,我按照 so_mv 的建议添加<msysgit_dir>\mingw\binPATH上面(通过系统变量 GUI),但之后我必须注销并登录到操作系统,否则该PATH值将不会更新。

回答by KristofMols

Fastest way to fix this is locating the *.dll file on the other pc and copy it =)

解决此问题的最快方法是在另一台电脑上找到 *.dll 文件并复制它 =)