Git & GitHub - Installation & Setup

A simple git and github installation guide

Git & GitHub - Installation & Setup

Create a GitHub account

Go to the official GitHub website click on the signup button and enter below details:

  • email ID

  • password and

  • username

then click on create account and enter the verification code received on your email ID. This will create your GitHub account.

Installing Git on your computer

Git can be downloaded from the Official Git Website for Windows, Mac or Linux OS. Once the download is completed you can click on the installer and install git with the recommended settings.

Once the installation is completed, you'll be able to see Git Bash & Git CMD installed on your computer.

Open Git Bash & follow the below steps to set up your Git username and email ID for your local repositories:

# To set username for all repositories
git config --global user.name "[your-name]"

# To set username for a single repository
git config user.name "[your-name]"

# To set email ID for all repositories
git config --global user.email "[your-email-ID]"

# To set email ID for a single repository
git config user.email "[your-email-ID]"

You can confirm your username and email ID using git config user.name and git config user.email respectively.

Creating a new repository on GitHub

To create a new GitHub repository go to https://github.com/new or click on a new repository on the GitHub website.

  • Enter the repository name (should be unique among all your repositories)

  • A short description (optional but recommended)

  • Select if you want your repository to be public or private

  • Then, click Create Repository to create your repository.

Initializing & Cloning repository

To initialize a local repository, you can open the git bash and change the directory (using the cd command followed by the path to a directory in Windows) to your desired location and enter the below command.

git init

The above command will initialize a local repository in the current directory (which you chose before executing the above command). Now to clone your GitHub repository to your local repository use the following command.

git clone "[github-repo-URL]"

This will now create a copy of your GitHub repository locally in a new folder. In the next article, we'll see how to work with GitHub. If you have any queries, leave a comment below and follow me for more content.