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

25

94

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

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.

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

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.

Any help on this would be most appreciated.

Thanks,

Pintle answered 7/8, 2010 at 17:25 Comment(7)
Shouldn't the DLL be in $GIT/lib instead of $GIT/bin? At least, that's the way it works on Linux/UNIX, libraries go in the lib directory. I don't know if msysgit uses the same layout scheme but it'd be quick to check.Somato
This question should be submitted as a bug to Git development. But for the life of me I can't find any "submit bug" links on the Git site...Catchfly
the first answer works, you should mark it as solved!Hymie
@DavidZ - You solved my problem. You answer must be the accepted answer here.Nathanialnathaniel
@Groundshaker no, first of all I posted a comment, not an answer; and it didn't solve the original poster's problem, so even if it were an answer it shouldn't be accepted. Anyway it seems that several of the existing answers already cover this fix (it should be libexec instead of lib, evidently), so I'm not going to post something that duplicates them. (But I'm glad my comment was useful.)Somato
@DavidZ: I agree with you. But in my case, I used the path C:\PATH\libexec first, and when I executed the git command I encountered an error about missing .dll file. Then I changed the path to C:\PATH\bin (its still my current path) and everything works smoothly. I am just wondering though.Nathanialnathaniel
Huh, interesting. Anyway I don't know enough about msysgit to post a generally useful answer, but if you'd like to take my comment and turn it into an answer, go right ahead.Somato
P
15

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.

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.

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.

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.

Thanks to everyone who tried to help with this!

Pintle answered 7/8, 2010 at 19:36 Comment(3)
+1. In case of error, always resort to a minimal native CMD session. It is generally instructive.Rijeka
Thanks, this solved my problem I change msysGit\bin for msysGit\cmd in the windows path.Gumbotil
copy C:\msysgit\mingw\bin\libiconv-2.dll C:\msysgit\bin I installed using "msysGit-netinstall-1.9.4-preview20140611"Xiphisternum
S
105

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

  • cd into your git install directory
  • copy mingw\bin\libiconv-2.dll libexec\git-core
    (or copy bin\libiconv-2.dll libexec\git-core if your installation has no mingw folder)

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.

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 not 1.7.4)
Sherly answered 2/8, 2011 at 20:29 Comment(9)
This was the solution to my problem. I think it's worth noting that this solution works particularly for errors during submodule update, but may fix other instances as well.Wunder
With git-1.7.8 I needed to copy files in the other direction; libiconv2.dll exists in libexec/git-core, but needed to be copied to bin (or linked: mklink /H libexec\git-core\libiconv2.dll bin\libiconv2.dll).Wunder
This workaround fixed msysGit 1.7.7.1 on Windows 2003 x64 for me. It was failing when I tried to run git submodule init and sadly, the only symptom I could see initially was a Jenkins job that would hang indefinitely. (Running git submodule init from a Git Bash window showed me the real error.) Thanks!Alight
Where in the world can I find the mingw directory? It's not anywhere inside the git install directory...Catchfly
@paulecoyote, +gapple: cheers, this combo worked a treat for me.Improbity
@grapple's fix worked for me with the latest build 1.7.10-preview20120409 except it was libiconv-2.dll.Vinia
This issue happens in the latest version as well - 1.8.1.2. And had to copy the dlls to bin folder as well.Modestia
TLDR: Atlassian Sourcetree: Copy libiconv2.dll into libexec/git-core as described. Rename libiconv2.dll to libiconv-2.dll. I Had this same error when trying to use the latest version of Atlassian Sourcetree. Sourcetree was set to use External Git (instead of embedded). Apparently libiconv2.dll and libiconv-2.dll are the same file, but SourceTree looks for the file named libiconv-2.dll, not libiconv2.dll. So, if you're using source tree, you need to rename libiconv2 after moving it to git-core.Tenderloin
@sensei-james edited the answer - when I created the answer ages ago it was without the dash. So if for whatever reason you are using a really old version of git the original answer would still apply. Thanks for keeping my answer updated - I doubt there will be many people installing the old version. (Also I guess this is still an issue too then, over five years later?)Sherly
S
42
  • copy /Program Files/Git/bin/libiconv-2.dll
  • to /Program Files/Git/libexec/git-core/
Sequel answered 21/9, 2011 at 10:16 Comment(3)
Thanks, this fixed it for me on my Win7 machine running git version 1.7.7.1.msysgit.0Pegmatite
Just wanted to note — my error message specified libiconv2.dll AND I had both libiconv2.dll and libiconv-2.dll in /bin.Shaylashaylah
This was helpful, thanks. If, like me, you don't have these folders, look for them in %USERPROFILE%\Local Settings\Application Data\GitHub (see my answer)Throughout
P
15

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.

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.

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.

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.

Thanks to everyone who tried to help with this!

Pintle answered 7/8, 2010 at 19:36 Comment(3)
+1. In case of error, always resort to a minimal native CMD session. It is generally instructive.Rijeka
Thanks, this solved my problem I change msysGit\bin for msysGit\cmd in the windows path.Gumbotil
copy C:\msysgit\mingw\bin\libiconv-2.dll C:\msysgit\bin I installed using "msysGit-netinstall-1.9.4-preview20140611"Xiphisternum
P
14

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

Added <msysgit_dir>\mingw\bin to PATH 

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

Pavyer answered 17/10, 2010 at 3:41 Comment(2)
This didn't work for me, had to copy the DLL to %WINDIR% (C:\windows)Acreinch
I added c:\MinGW\bin to path, and that fixed it.Harlan
C
10

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

Git Executable:

from

/usr/bin/git

to:

/usr/local/git/bin/git
Cariecaries answered 2/2, 2017 at 20:56 Comment(1)
Thanks! In my case, I had to use /usr/local/bin/git.Lehr
G
3

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

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

git -- version 

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

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.

Gileadite answered 21/10, 2012 at 4:11 Comment(0)
T
3

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

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

Throughout answered 14/8, 2013 at 17:24 Comment(1)
After some trial & error I found that copying libcrypto.dll, libcurl.dll, libiconv-2.dll and libssl.dll to the git-core directory and that worked for one repository (minimal solution). Would not be surprised if I end up copying all the others too for others.Distinctive
T
2

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

Timmie answered 7/8, 2010 at 17:40 Comment(0)
E
2

To resolve this issue I actually had to copy all DLLs from mingw/bin/ to bin/ (not overwriting any existing once). I use remote HTTPs repositories and it just kept on complaining.

Expanse answered 20/11, 2011 at 14:6 Comment(0)
C
2

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.

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

Hoping that this is the right approach.

Constructionist answered 26/3, 2012 at 8:57 Comment(1)
I am using GIT for windows and for me it worked by pointing to git.exe.Prognosis
L
2

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

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

Lichi answered 25/7, 2012 at 20:25 Comment(0)
E
1

I had the same error on Windows 7 when running \msysgit\bin\git.exe. I fixed it by copying the \msysgit\mingw\bin\libiconv-2.dll to the root of Win 7 installation directory.

Emeldaemelen answered 13/8, 2012 at 15:3 Comment(0)
U
1

I installed Git for Windows, then Git in order to copy the .dll

This did not work for me. To solve the issue I had to add the path:

C:\Users\*username*\AppData\Local\GitHub\PortableGit_015aa71ef18c047ce8509ffb2f9e4bb0e3e73f13\cmd

to the PATH environment variable.

This cleared up the issue and I can now access git from the command prompt.

Undersea answered 25/8, 2013 at 0:21 Comment(1)
I am using the Git plugin for Sublime Text 2 where I came across this issue and solved it by adding a similar path into the plugin settings but with all the backslashes escaped as follows: C:\\Users\\*username*\\AppData\\Local\\GitHub\\PortableGit_054f2e797ebafd44a30203088cd3d58663c627ef\\bin\\git.exeDynamoelectric
S
1

Personally I solved it by reading the error I got from getopt.exe, that told me it was missing "libiconv2.dll".. I had libiconv-2.dll (notice the dash "-") in C:\Program Files (x86)\Git\bin. Making a copy and naming it libiconv2.dll did the trick for me...

I used some chocolatey packages ... maybe the actual file was renamed during its development lifetime... and the dependencies in the packages did not....

Well hope it helps someone out there :)

Shaunteshave answered 31/7, 2015 at 20:14 Comment(0)
B
1

If the error "missing libiconv-2.dll" occurs while starting SourceTree on Windows, following worked for me (Win 8.1):

go to

C:\Users\$USERNAME$\AppData\Local\Atlassian\SourceTree\git_local\bin

copy

libcrypto.dll
libcurl.dll
libiconv-2.dll
libssl.dll

to

C:\Users\$USERNAME$\AppData\Local\Atlassian\SourceTree\git_local\libexec\git-core
Blondie answered 31/8, 2015 at 17:10 Comment(0)
U
1

One possible solution for SourceTree:

   1.Open the "Option" window.
   2.Select "Git".
   3.Than "Use System Git".
   4.And press OK button.
Unsnarl answered 28/6, 2016 at 13:34 Comment(1)
Worked for me. For some reason, SourceTree switched to embedded git after the update, which caused the issue.Panhellenism
R
0

I have msysgit on Windows7 without any issue with any DLL.

I have libiconv2.dll in the bin directory: C:\Path\To\Git\1.7.1\bin

The issue 419 was about someone who installed the "development environment to compile Git for Windows", not just Git.
See this SO answer for the difference between the two.

So which one did you install?

  • Git-1.x.x.x...? (like 'Git-1.7.0.2-preview20100309.exe'),
  • or msysGit-netinstall-1.x.x...? (like 'msysGit-netinstall-1.7.1-preview20100612.exe').
Rijeka answered 7/8, 2010 at 18:31 Comment(6)
I Installed.. Git-1.7.0.2-preview20100309.exe I definitely realize Issue 419 was a developer install, but it is one of the only search results I could find on this subject, so I hoped it might provide some insight. My libconv2.dll is in C:\Path\To\Git\bin, which is just the default install location.Pintle
@thankyoud: I understand (and your question seems well documented). Just thought to make that extra clear in my answer, for other to see the difference. The only other issue I have seen with Git having trouble to run is related to the ACL (like some kind of dll registration issue, or %TEMP% writing issue). Any clue on that front?Rijeka
I dunno, the %temp% directory seems to have full access for my current account. Does git run under an account other than administrator when you bash? Also, as I mention before, this has never happened on any other Windows 7 install I've done...so that is why I am so perplexed. That is to say, I've never needed to fiddle with file permissions in the past.Pintle
@thankyoud: Strange. What about the "portable" installation? (just unzip it, and add the cmd directory to your path): will it exhibit the same faulty behavior?Rijeka
@thankyoud: is there any conflict in the PATH on this particular Windows7? Do you see the same error with a 'minimal PATH' ? I.e. "C:\Path\To\Got\cmd;C:\Windows\system32;C:\Windows;C:\Windows\Syste m32\Wbem"Rijeka
Hi, Thanks for all of your input on this...but I did find a solution, and posted it a few mins ago.Pintle
A
0

I originally tried to solve this problem by copying the dll as mentioned here but soon ran into other problems. For me the real solution was to set the path in my .bashrc file for msys to prioritize the msys binaries.

Open the msys shell and the following line in ~/.bashrc:

export PATH=/usr/local/bin:/mingw/bin:/bin:$PATH

Aliform answered 9/3, 2012 at 3:35 Comment(0)
T
0

I've been plagued with this issue, to correct this issue, i uninstalled tortoisegit and msysgit, then i reinstalled "Git-1.8.1.2-preview20130201".

by doing this, this corrected my issue and i'm not able to use poshgit.

Training answered 15/2, 2013 at 20:59 Comment(0)
D
0

In my case I used chocolatey (chocolatey.org) to install git.

I had to copy libconv-2.dll to C:\ProgramData\chocolatey\bin to get it working. I'm not sure if copying the file to C:\Program Files (x86)\Git\libexec\git-core is also necessarily, as I did that first.

Disheveled answered 11/8, 2014 at 11:22 Comment(0)
S
0

I was using GitHub Desktop Version and having same problem, I changed Default shell by Setting-->Options--->Default shell and checked Git bash. I started "Open Git shell" and run "git pull" command, it fixed problem. It worked in my case.

Sailboat answered 2/4, 2016 at 8:3 Comment(0)
R
0

Copy all .dlls from:

C:\Users\YOURUSERNAME\AppData\Local\GitHub\PortableGit_25d850739bc178b2eb13c3e2a9faafea2f9143c0\mingw32\bin

to:

C:\Users\YOURUSERNAME\AppData\Local\GitHub\PortableGit_25d850739bc178b2eb13c3e2a9faafea2f9143c0\mingw32\libexec\git-core

Refractive answered 27/4, 2016 at 2:44 Comment(0)
R
0

I had the same problem, I am using Windows 10 and it is super easy to solve this problem.

Download the dll file from:

https://www.dll-files.com/libiconv-2.dll.html

extract it or paste it into the mingw folder directly, it's generally in C- drive if you have installed it using default options. Hope it helps.

Rother answered 25/4, 2017 at 9:47 Comment(0)
S
0

Try the following command:

sudo rm -rf /Library/Developer/CommandLineTools 

and install developer tools

Seagoing answered 7/8, 2017 at 11:59 Comment(0)
L
-1

I had to deal with this same error message while trying to configure meanio, of which git is a prerequisite (my particular error was: prerequisite not found: git).
The fix I figured out entailed copying libiconv2.dll from

C:\Program Files (x86)\Git\bin

to

C:\Program Files (x86)\Git\libexec\git-core

Then I had to make some adjustments to the windows system Environment Variables (Right click computer, go to properties, click "Advanced System Settings" on the left vertical bar, select environment variables) Once in Environment Variables, look in the System Variables box. Find the

PATH

Variable and add three new references:

C:\Program Files (x86)\Git\bin;
C:\Program Files (x86)\Git\cmd;
C:\Program Files (x86)\Git\libexec\git-core

This way all the required git files are accessible across the system path.

Hope this helps!

Lachrymatory answered 5/8, 2014 at 15:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.