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,

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user413945
  • 1,141
  • 1
  • 7
  • 8
  • 1
    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. – David Z Aug 07 '10 at 17:43
  • 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... – Andriy Drozdyuk Jan 14 '12 at 07:48
  • 1
    the first answer works, you should mark it as solved! – erikbstack Apr 16 '12 at 11:20
  • @DavidZ - You solved my problem. You answer must be the accepted answer here. – Mekey Salaria Dec 01 '14 at 07:49
  • @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.) – David Z Dec 01 '14 at 08:03
  • @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. – Mekey Salaria Dec 01 '14 at 11:05
  • 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. – David Z Dec 01 '14 at 11:07

25 Answers25

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)
Sensei James
  • 2,617
  • 30
  • 36
paulecoyote
  • 1,733
  • 2
  • 13
  • 11
  • 5
    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. – gapple Sep 15 '11 at 23:07
  • 9
    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`). – gapple Dec 13 '11 at 17:20
  • 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! – Paul Karlin Jan 09 '12 at 15:28
  • Where in the world can I find the `mingw` directory? It's not anywhere inside the git install directory... – Andriy Drozdyuk Jan 14 '12 at 07:45
  • @paulecoyote, +gapple: cheers, this combo worked a treat for me. – danjah Apr 16 '12 at 22:54
  • 4
    @grapple's fix worked for me with the latest build 1.7.10-preview20120409 except it was `libiconv-2.dll`. – Soliah May 25 '12 at 05:43
  • This issue happens in the latest version as well - 1.8.1.2. And had to copy the dlls to bin folder as well. – parsh May 13 '13 at 20:49
  • 1
    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. – Brandon S. Apr 14 '16 at 17:46
  • @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?) – paulecoyote Oct 07 '16 at 02:45
42
  • copy /Program Files/Git/bin/libiconv-2.dll
  • to /Program Files/Git/libexec/git-core/
sqzaman
  • 636
  • 7
  • 5
  • 1
    Thanks, this fixed it for me on my Win7 machine running git version 1.7.7.1.msysgit.0 – jesal Nov 11 '11 at 18:01
  • 1
    Just wanted to note — my error message specified libiconv2.dll AND I had both libiconv2.dll and libiconv-2.dll in /bin. – Roger_S Jun 11 '12 at 21:36
  • 1
    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) – wytten Aug 14 '13 at 18:29
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!

user413945
  • 1,141
  • 1
  • 7
  • 8
  • 1
    +1. In case of error, always resort to a minimal native CMD session. It is generally instructive. – VonC Aug 07 '10 at 22:40
  • Thanks, this solved my problem I change msysGit\bin for msysGit\cmd in the windows path. – Renaud Mar 22 '13 at 09:22
  • ``copy C:\msysgit\mingw\bin\libiconv-2.dll C:\msysgit\bin`` I installed using "msysGit-netinstall-1.9.4-preview20140611" – Jeflopo Jul 07 '14 at 04:08
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.

so_mv
  • 3,939
  • 5
  • 29
  • 40
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
Cooler
  • 309
  • 3
  • 6
  • 17
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.

Erdinç Çorbacı
  • 1,187
  • 14
  • 17
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

wytten
  • 2,800
  • 1
  • 21
  • 38
  • 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. – alle_meije Jun 18 '14 at 07:18
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.

Community
  • 1
  • 1
sompylasar
  • 924
  • 11
  • 15
2

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

KristofMols
  • 3,487
  • 2
  • 38
  • 48
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.

Echilon
  • 10,064
  • 33
  • 131
  • 217
Kingen
  • 21
  • 1
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.

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.

Boris Jockov
  • 614
  • 1
  • 6
  • 15
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.

Luis Quijada
  • 2,345
  • 1
  • 26
  • 31
  • 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.exe` – Jasdeep Khalsa Sep 05 '14 at 09:32
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 :)

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
felix
  • 11
  • 1
1

One possible solution for SourceTree:

   1.Open the "Option" window.
   2.Select "Git".
   3.Than "Use System Git".
   4.And press OK button.
flaviussn
  • 1,305
  • 2
  • 15
  • 33
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.

AdamWhite
  • 1,044
  • 2
  • 10
  • 10
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.

Luke Chavers
  • 703
  • 8
  • 8
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').
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 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. – user413945 Aug 07 '10 at 18:42
  • @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? – VonC Aug 07 '10 at 18:54
  • 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. – user413945 Aug 07 '10 at 19:13
  • @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? – VonC Aug 07 '10 at 19:28
  • @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"` – VonC Aug 07 '10 at 19:33
  • Hi, Thanks for all of your input on this...but I did find a solution, and posted it a few mins ago. – user413945 Aug 07 '10 at 20:21
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.

Muneesh
  • 433
  • 10
  • 19
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

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206
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.

0

Try the following command:

sudo rm -rf /Library/Developer/CommandLineTools 

and install developer tools

Koby Douek
  • 16,156
  • 19
  • 74
  • 103
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

Judah Menter
  • 270
  • 1
  • 3
  • 7
-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!

deusofnull
  • 91
  • 1
  • 11