Git on Windows – Part 2: Configuration

After you have completed the installation of both TortoiseGit and mysysgit the next step is to generate yourself an SSH key to connect to an existing git repository. This key will be used to authenticate you with your remote Git repository.

To generate SSH Key using “PuTTY Key Generator” that comes with TortoiseGit.  You will find this under Start > Programs > TortoiseGit.

Run the PuTTY Key Generator and click “Generate”. Now move your mouse around on the blank area until it tells you to stop.

Once the key has been generated your public key will be shown in the blank area.

Enter a passphrase if desired, TortoiseGit will prompt you for this when you connect to the git repository.

Do not use the “Save public key” button.  It saves it in a strange format that only PuTTY understands. Instead copy the public key temporarily into Notepad for later use.

Then click the “Save private key” button and save the private key file to the hard drive. TortoiseGit will prompt you for this when you use TortoiseGit to clone the git repository.

When using remote repository such as GitHub or BitBucket you will need to give them your “Public” key. Normally this just involves copy/pasting the textual key into a box in your account settings on the repository management site (such as GitHub or BitBucket).

GitHub

In GitHub, you will find: “Edit your Profile > SSH Keys > Add New SSH key” and looks like below.

Give the key a meaningful name. Copy the SSH key you have saved in Notepad earlier and paste it here.

BitBucket

Copy the SSH key you have saved in Notepad earlier and paste it here then Click Add Key.

Use TortoiseGit to run the git clone command. The “git clone” command creates a local copy of a remote repository.

In Windows Explorer, right-click your root project folder and click “Git Clone…”.

Url: The Url of the remote repository.

Directory: This will be pre-filled with your root project folder. This may now include the name of the project specified in Url. Change this as necessary to point to your desired local folder.

Load Putty Key: Select the private Putty key that you saved earlier.

Click OK.

The git project source is successfully cloned to your local system.

Posted in Git, Version Control | Leave a comment

Git on Windows – Part 1: Installation

Download and install mysysgit from here

Download and install TortoiseGit from here

During the installation process you need to carefully select some important options.  I will explain step by step installation with the screenshots.

Click Next to accept GPL License.

You can select Windows Explorer integration option if you required.

select “Use Git Bash only” option.

Select “Checkout Windows-style, commit Unix-style line endings” for cross platform projects. The style of line ending you choose is very important. Typically most projects will use Unix style line endings which are simply a single “Line Feed” character. Whilst most Windows systems can handle this just fine Windows Notepad will not recognise this and will show the file without any line breaks.

If you are using Visual Studio and/or developing .Net or Windows only applications you may want to select “Checkout as-is, commit as-is” option to prevent any possible odd behaviour in Visual Studio.

Finally Git Installed on Windows.

Posted in Git, Version Control | Leave a comment