It really sucks having to recreate your Git setup when you have spent a couple of hours already. Recently I installed a new hard-disk and re-installed Windows. Just before formatting the old hard-disk, I remembered that I need to re-install Git and redo all the other activities that go with it again.
Here is the quick way to copy over Git settings to the new Windows installation.
- Make a copy of the .gitconfig file present at C:\Users\<YOUR USER NAME>. Alternatively run echo %userprofile% in a command window to find the folder location.
- Make a copy of the .ssh folder present under the same folder mentioned in the previous point.
- After switching to the new Windows installation, install Git. Once the installation is finished, copy the files into the new %userprofile% folder. If prompted, overwrite any exsiting files.