Beginner level query regarding Git and GitHub

Hi, I am curious in knowing

  1. How are Git and GitHub realted to coding in R.
  2. Do we store codes in github by copy pasting it from RStudio or Jupytr IDE to Github or something else is happening.
  3. Why it is usually said that for digital presence we need to have Github account? What basically we do there apart from version control?
  4. If we are sharing codes in online platforms aren’t we vulnerable to sharing important company information like restricted knowhow etc?
© Copyright 2013-2019 Analytics Vidhya