Skip to content

Instantly share code, notes, and snippets.

@OddExtension5
Last active July 11, 2020 12:34
Show Gist options
  • Save OddExtension5/91ddd0cce7d7f7ca8ebde439011b7d9f to your computer and use it in GitHub Desktop.
Save OddExtension5/91ddd0cce7d7f7ca8ebde439011b7d9f to your computer and use it in GitHub Desktop.
This gist covers GitHub Advanced Concepts and Tricks

Clone a repo from GitHub using SSH on Windows

Steps:

  1. Open Git Bash

  2. Go to .ssh folder and type the below command:

    ssh-keygen -t rsa -b 4096 -c "your_email_address"

  3. Adding ssh key to the ssh-agent

    • Start up the ssh-agent everytime you start the terminal

      eval $(ssh-agent -s)

    • Add rsa key to the ssh-agent every time you start terminal!

      ssh -add ~/.ssh/id_rsa OR ssh -add id_rsa

  4. Add SSH to the github account.

    • Copy the SSH key to your clipboard

      clip < ~/.ssh/id_rsa.pub OR clip < id_rsa.pub

    • On your GitHub account got to Setting --> SSH & GPG keys --> Paste the Key

  5. Test you SSH Connection

    ssh -T git@github.com

Steps to setUp Git + GitHub on you local system and making a Pull Request

Steps:

  1. Download and install Git on your local system.

  2. After installing Git, Open Terminal and set a Git Username

    git config --global user.name "type_username_of_you_choice"
    git config --global user.name # echo your username

  3. Set an email address in Git

    git config --global user.email "your_email_address"
    git config --global user.email # echo you email

  4. GitHub Time ! Set Up an account on GitHub

  5. For contribution to the project:

    • Fork the repository -- This creates a copy on your account.
    • Clone the repository to your computer
      • Click on Clone OR Download Button OR
      • Open Git Terminal and type

        git clone "url you just copied"

How to update a forked repo with git rebase

Step 1: Add the remote (original repo that you forked) and call it “upstream”

git remote add upstream https://github.com/original-repo/goes-here.git

Step 2: Fetch all branches of remote upstream

git fetch upstream

Step 3: Rewrite your master with upstream’s master using git rebase.

git rebase upstream/master

Step 4: Push your updates to master. You may need to force the push with “--force”.

git push origin master --force

OR Go To : https://github.com/KirstieJane/STEMMRoleModels/wiki/Syncing-your-fork-to-the-original-repository-via-the-browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment