Git on windows

Git bash on windows allows you to generate an ssh key by using openssl.

ssh-keygen -t rsa -b 4096 -C "" [1]

However if you try to run git clone it doesn't let you use the ssh key generated.

Instead you'll need to do: ssh-agent sh -c 'ssh-add ~/.ssh/id_rsa; git fetch user@host' [2]

I had tried running the ssh-agent as stated by github's page but git bash would still ask me to provide password for rather than asking for id_rsa password.


Today I encountered this issue again and decided to look further into it. When I installed git for Windows I chose to also have windows cmd/powershell be able to use git. I tried cloning from it and it worked.

This made me wonder why right clicking and opening Git Bash which opens a MINGW64 shell did not allow me to git clone and still asking me for the password for

The problem is that the URL copied from the browser is encoded in UTF-8. MINGW64 by default is not set to the right locale to take that string properly. Right Click the title for Git Bash and select Options..., Click on Text and select en_US for the Locale and UTF8 for the Character Encoding. Apply and Save. This should fix encoding inconsistencies.


Got comments or issues with what I wrote? Please let me know by submitting an issue with the blog title :)