You are currently viewing How To Create An Account In GitHub

How To Create An Account In GitHub

How To Create An Account In GitHub

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

GitHub is one of the most popular and widely used code hosting platform in the world. In this blog post, we will discuss how to create an account in GitHub and getting started with GitHub.

This tutorial will cover below topis steps by steps and is intended for someone who is just getting started with GitHub.

  1. How to create a new account in GitHub
  2. How to create a repository in GitHub
  3. How to clone a GitHub repository in your local system
  4. How to setup SSH key for GitHub
  5. How to push changes from your local system to GitHub
  6. How to pull changes from GitHub to your local system
  7. Difference between Git Pull and Git Fetch with example
  8. How to create a Pull request in GitHub and more.

How To Create An Account In GitHub

Prerequisites:

  • (Required) One active email id
  • (Optional) One system having git installed

Step 1: Signup with GitHub.

Open your browser and navigate to below link

https://github.com/signup?source=login

Provide your preferred email id and password and complete the registration.

How To Create An Account In GitHub

Step 2: Validate your email id.

One code will be sent to your email id, use that code to verify your account.

Once verified, you will be redirected to your GitHub account.

How To Create An Account In GitHub

We have successfully created our first GitHub account. Next, we are going to create our first repository in GitHub. A repository in GitHub is a container to store all your files. You can create a public or privet repository in GitHub.

Step 3: Create a GitHub repository.

Click on “Create repository” to create a new repository in GitHub.

How To Create An Account In GitHub

Provide a name and description to your repository, select the repository visibility to private and click “create repository”. You can also include a README file which will contain details about your repository.

  • Public: Anyone on the internet can see this repository. You choose who can commit.
  • Private: You choose who can see and commit to this repository.

How To Create An Account In GitHub

We have successfully created our first GitHub repository.

How To Create An Account In GitHub

Observe: At the top of this page, you have the URL to clone your GitHub repository using HTTPS or SSH options. Since we have created a private repository, only you can clone the repository using HTTPS or SSH.

The repository that we have just created is called a remote repository where multiple members can created/update/delete files. You can also create a local copy (local repository) of this GitHub repository by cloning this repository in your local system.

Step 4: Clone your GitHub repository using HTTPS

In the clone URL, select HTTPS and copy the URL

How To Create An Account In GitHub

Open command prompt type below command

You will be prompted to provide access code, close the window and provide email id and password that you have used during signup with GitHub.

How To Create An Account In GitHub

How To Create An Account In GitHub

Don’t worry about the warning, as we have created an empty repository it giving us a warning. Next, we are going to create a file and push that into our GitHub repo.

Step 5: Push changes to GitHub

The file README.md has been pushed from our local repository to GitHub.

Refresh the GitHub page and you will be able to view the file.

How To Create An Account In GitHub

GitHub allows you to access its repository using either HTTPS (using personal access token or email id and password) or SSH. We have already used HTTPS (using email id and password) method. Next, we are going to see how to generate a SSH key and setup ssh key’s in GitHub.

Step 6: Check if ssh-keygen is installed.

Open command prompt and type

If You get some output, that means ssh-keygen is already present.

If ssh-keygen is not present then follow below steps to enable ssh-keygen.

Right click on windows start menu and click on “settings”.

How To Create An Account In GitHub

On the settings page, click on “Apps

How To Create An Account In GitHub

Click on “Optional features

How To Create An Account In GitHub

And then click on “Add” and select “OpenSSH Client” and click “install”.

How To Create An Account In GitHub

Step 7: Generate SSH Key For GitHub.

In the command prompt, type below command to generate a new SSH key pairs

How To Create An Account In GitHub

Copy the content of your public key

Navigate to C:\ => Users => <Your_UserName> => .ssh

And copy the content of id_rsa.pub file. The other file id_rsa is your private key.

How To Create An Account In GitHub

Step 8: Setup SSH Key in GitHub

Open your GitHub repository and click on your profile icon at the extreme right corner. Click on settings.

How To Create An Account In GitHub

Click “SSH and GPG keys” and then click “New SSH key

How To Create An Account In GitHub

Copy the public key content inside the box next to key, provide a “Title” and click “Add SSH key”.

How To Create An Account In GitHub

Navigate back to your GitHub repository and copy the repo URL for SSH

How To Create An Account In GitHub

Step 9: Add a new remote repository to an existing local directory

Observe the README.md file has been pulled from the remote GitHub repository to your local repository. Next, we are going to create a new branch and push the changes from our local repository to GitHub repository

Step 10: Push changes from local repository to remote repository.

Create a new branch in your local repository and add some files and finally commit the changes.

If you check your GitHub repository, you will be able to find your branch and the file that you have added present in GitHub as we have pushed the changes.

How To Create An Account In GitHub

Next, we are going to show how to pull from your remote repository to your local repository.

Step 11: Pulling changes from remote repository to local repository.

Navigate back to the other local repository where we have initially cloned our GitHub repo

Observe branch1 info is missing in this local repository.

Pull the changes from remote repository to local repository

Observe, after the pull branch1 info has been updated in this local repository as well.

Next, we will find out what is the difference between git pull and git fetch

Step 12: Understanding the difference between git pull vs git fetch.

Update and commit some content in your GitHub repository

Navigate to your GitHub repositor and select the master branch

Click on the edit icon to edit the file inside GitHub.

How To Create An Account In GitHub

Add some lines and click on “Commit changes

How To Create An Account In GitHub

Check the difference between your local master branch and remote master branch

No difference is reported as our local repository does not know what have changed in our remote repository. You can update your local repository to make those changes visible to it in two ways – git fetch or git pull. The difference between the two is git fetch only gathers the updates (what changed) in your remote repo but does not include them in your local repository whereas git pull gets those changes and also update (merge) your local repository with those changes.

But files are not yet updated. If we had done a pull instead of fetch, README.md file would also have been updated. We are going to do exactly that in next step

Update your local repository using git pull

Observe the file README.md also has been updated

Step 13: Creating a Pull request in GitHub.

Navigate to your remote repository and click “Pull requests

How To Create An Account In GitHub

You can directly create a pull request to merge branch1 with master by clicking “Compare & pull request” or click on “New pull request

How To Create An Account In GitHub

Select the source and target branch and click “Create pull request

How To Create An Account In GitHub

Add a comment and click “Create pull request

How To Create An Account In GitHub

Accept the pull request by clicking on “Merge pull request

How To Create An Account In GitHub

Branch1 successfully merged with master, if you want you can delete the branch1.

How To Create An Account In GitHub

Hope you have enjoyed this article. To know more about GitHub, please refer below official documentation

https://docs.github.com/en

Leave a Reply