Cygwin for Windows provides binary ports of many well known Linux tools including grep, ssh, tetex, svn, bash, or find. After installation, most of the tools work just fine. Unfortunately, git – the popular distributed version control system – is not one of them. When running your first git clone on the Windows command line, you will not be able to enter your username or password at the prompt. However, when you press <Control>+C, you will find that the git command is canceled and your username or password will be printed on the command line prompt. Although, it is not really intuitive, there is an easy-to-use fix that allows you to make Cygwin’s port of git usable.
As discussed in this article on superuser.com, the issue with git’s interactive prompts can be traced down to a problem with mintty – Cygwin’s terminal emulator window. In order to fix the problem, it is necessary to install an additional program such as ssh-ask-pass that takes care of handling the prompts. Once the program is installed, you just configure git to use the program instead of forwarding prompts to the command line and you’re done. To do this, you can either set the GIT_ASKPASS environment variable or you can set the git core.askpass global configuration option. Here are the necessary steps in more detail:
Download this unofficial binary build of ssh-ask-pass for Cygwin and unpack it in your Cygwin root directory. Besides from some documentation, this will install win-ssh-agent.exe and win-ssh-askpass.exe under /usr/bin.
Option 1 (environment variable): Open a Windows command line and set an environment variable using SET GIT_ASKPASS=C:\Cygwin\usr\bin\win-ssh-askpass.exe before using git or make the setting permanent using Window’s advanced system settings dialog (just type systempropertiesadvanced.exe in the search box and hit enter, click environment variables, click new, use GIT_ASKPASS as the variable’s name and C:\Cygwin\usr\bin\win-ssh-askpass.exe as the variable’s value).
Option 2 (git configuration option): Open a Windows command line and run git config –global core.askpass C:\Cygwin\usr\bin\win-ssh-askpass in order to tell git to use the configuration globally and permanently. This will create a subsection [core] with a setting askpass = C:\\Cygwin\\usr\\bin\\win-ssh-askpass in the .gitconfig file (which is normally in your Cygwin home directory).
That’s almost too easy, have fun coding.