Skip to content

A repository containing instructions to connect GitHub and Git and VsCode

Notifications You must be signed in to change notification settings

bonface221/connecting-git-and-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Connecting Github and Git using VsCode

What is Github?

GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to their code

Terms used in Github and git

  1. Git

    Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

  2. Version Control System

    describes a type of software that is designed specifically to help manage the complexities - and so much more!

    Advantages of Version Control

    • Automatically create a backup of your work
    • Provide an easy way to undo mistakes and restore a previous version of your work
    • Document changes with a log that describes what's been changed and why
    • Keep file names and hierarchies consistent and organized
    • Branch work off into multiple "sandboxes" (called branches in Git) that allow developers to experiment without impacting other branches
    • Collaborate with others without disturbing each other's or our own work
  3. Repository(or repo in short)

    A directory of files that are tracked by Git.

  4. Track

    When a file is tracked by Git, it means that Git will notice any changes to that file. We call these changes differences or diffs. Git allows you to choose whether to commit a diff in order to keep it.

  5. Diff

    The diff of a file is all the changes that have been made to it since the last commit. The diff of a repo is all the diffs in all the tracked files in the repo that have not yet been committed (sometimes programmers call this the diffset)

  6. Commit

    Once we decide we want to save a diff, we commit the diff to the repo's history using the commit command. When we make a commit, we write a log message that describes what happened in the diff. The set of commits provides a history of all of the changes that have been made to a repo and when.

  7. Log

    A record of what happened in each commit.

  8. Local/Remote

    Local refers to the repo on our personal system the local repo.Remote refers to the repo hosted on GitHub

  9. Branch/default branch

    A Git repo can support multiple branches that make it possible for multiple developers to be working on the code at the same time.When you initialize a new Git repo a default branch is created (main) where your work will be tracked by default.

  10. Pull Requests

    These are hearts of collaborations. With a pull request you are proposing that your changes should be merged with the main branch from your branch..

Creating a New Branch

git branch <Branch name>

switching to another branch that does not exitst specifying it shoud be created using -b

git checkout -b <branch name>

switching to an already existing branch

git checkout <branch name>

Softwares You Need and how to download them

  1. Softwares

    • Git
    • VsCode
  2. Installations

    1. Windows

      • VsCode

        Navigate to this Website here

      • Git

        Navigate to this Website here

    2. Linux

      • VsCode

        sudo apt update
        sudo apt upgrade
        sudo apt install code
        

        if this does not work install vscode manually using this link here if you still insist on installing using the terminal then read this article and follow the instructions here

      • GIT

        # apt-get install git
        # add-apt-repository ppa:git-core/ppa 
        # apt update
        # apt install git
        

Useful VsCode extensions

  • How to install vscode extensions:
    1. From Extensions > Manage Extensions, find the extension you want to install. (If you know the name or part of the name of the extension, you can search in the Search window.)
    2. Select Download.
  • Must have extensions:
    1. colorize
    2. Prettier
    3. icon fonts
    4. live server
    5. bracket pair colorizer
    6. js ES6 snippet
    7. live share extension

Creating a Github Account

  • if you have not sign-up proceed to this url Github signup webpage
  • Fill out the form and create an account
  • verify Email Address connected to your Github Account

if you were able to verify email address, continue below

Configure Git and GitHub

Git is the tool we use to download and upload our code online. To use Git without signing every time, you need to create a Secure Shell (SSH) key and associate that to your GitHub account.

Follow the steps below and everything will be done:

Steps

  1. Open the terminal in your vsCode or gitbash in windows or press ctrl + ` on linux
  2. Type git config --global user.name + Space + your name and press Enter. (Note this should be your full name, not your GitHub username, in quotes)
  3. Type git config --global user.email + Space + the email address you used to sign up to GitHub and press Enter
  4. Type git config --global init.defaultBranch main to update the default branch name to main
  5. Type ssh-keygen and press Enter.For each prompt do not type anything, just continue to press Enter. It's particularly important that you do not enter a passphase; you should leave the passphrase empty when prompted.
  6. Type cat ~/.ssh/id_rsa.pub | clip.exe and press Enter. This will copy your SSH key to your clipboard
  7. Open the Github New SSH key form (NOTE: You need to be logged in to access this link)
  8. Type "My personal PC" in the "Title" input field
  9. Paste what's on your clipboard from step six in the "Key" input field
  10. Click "Add SSH Key"

If you see your new SSH key beneath the "SSH keys" heading You have finally managed to configure your github...

Enjoy

About

A repository containing instructions to connect GitHub and Git and VsCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published