Skip to content

Git for Beginners - Installation

This article contains a list of commands that will be helpful for beginners when starting out with Git.

I am using Git SCM but you can use any git tool to run any git command.

Install Git SCM

This is a straight forward step. Depending on the system you are using you can install git scm as displayed on their website.

If you are planning to use git with github or gitlab, for easy access, it will be good to setup SSH key.

Generate SSH key for Git

  1. Run the following command to generate a key pair. If you don't have ssh-keygen installed, please search for it. There are plenty of sources to find it. This creates a new ssh key, using the provided email as a label. The following will be shown on the terminal.   ssh-keygen -t rsa -b 4096 -C "[email protected]"  
  2. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.

Generating public/private rsa key pair. Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter here]

Note the location "/c/Users/you/.ssh/id_rsa"**. This is where your public key is.

At the prompt, type a secure passphrase. A passphrase provides additional security. If you work on very critical projects, use a passphrase.

For more information, see Working with SSH key passphrases

Enter passphrase (empty for no passphrase): [Type a passphrase or Just Press Enter] Enter same passphrase again: [Type passphrase again or Just Press Enter]

Now you will see the generated key in the above location /c/Users/you/.ssh/ on Windows or ~/.ssh/ on ubuntu. Open the (this is your public key) using a text editor. Copy the text.

Add SSH Key to Github

  1. Log into your Github account. Go to this link:

  2. Click on New SSH key button on top.

  3. Add a unique name to identify your device for title.
  4. Paste the copied text to key section.
  5. Click Add SSH key.

Now that your SSH key is added to Github you can use SSH link to access the repository.