GitHub: A Beginner's Guide

GitHub: A Beginner's Guide

·

3 min read

GitHub is a cornerstone of modern software development for several reasons:

  • Version Control and Collaboration: It allows developers to track changes to code throughout a project's history. This facilitates teamwork by enabling multiple developers to work on the same codebase simultaneously, see each other's changes, and merge their work seamlessly.

  • Open Source Development: GitHub fosters open-source collaboration, where code is publicly shared and anyone can contribute. This fuels innovation as developers can build upon existing projects, leading to faster development and a wider range of solutions.

  • Project Management and Communication: GitHub offers functionalities like issue tracking and pull requests, which streamline communication and project management. Developers can raise issues (bugs or problems) and discuss solutions, and pull requests allow proposing code changes for review and merging.

  • Code Discovery and Sharing: Programmers can discover existing open-source projects relevant to their needs and directly incorporate them into their own work. This promotes code reuse and reduces development time.

  • Social Coding Platform: GitHub functions like a social network for programmers. Developers can find and follow other users, showcase their work through public repositories, and contribute to discussions, fostering a global coding community.

  • Portfolio and Credibility: For programmers, a well-maintained GitHub profile showcasing their contributions to open-source projects or personal projects serves as a portfolio and demonstrates their skills to potential employers.

Hands-on practice:

Account Setup:

  • Create a new GitHub account.

  • Configure SSH key in your local machine and add it to git hub profile.

ssh-keygen

  • Copy the public key in to the Github profile. Go to Settings->SSH and GPG keys -> New SSH Keys and Save.

  • Create personal access token in Github account

Go to settings -> Developer Settings -> Personal access tokens -> Generate new token(classic)

  • Create a repository in Git hub

  • Push the Code from local machine to the newly created repository.

    Add files to a newly created repository:

Note: Token needs to be included(greenmarked) in the remote repo

  • Refresh the newly created repo for the latest code update

Add files to an existing Repo:

  1. Crea a directory in your local PC and Clone the repo

  2. perform git init

  3. Add new file to the repo.

  4. Commit the changes.

  5. Push the changes.

  6. Changes reflected in the repository

Remove file from a repository and push it back:

  1. Clone the repo and delete the required file

  2. Push the changes

  3. Changes reflected in the repository