Working with GitHub

From Microbial Ecology and Evolution Lab Wiki
Revision as of 11:23, 19 June 2024 by EricMiller (talk | contribs) (Created page with "GitHub is a way to keep track of your code for a project, while also allowing a team to work independently on the same project. It is a bit unintuitive to use; it combines using a web browser with command line functions (through the Mac terminal, or Windows Command Line). =Installing Git (one time only)= Macs: Install Xcode, which will include Git automatically <br> <code> xcode-select --install </code> Windows: https://git-scm.com/download/win To check to se...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GitHub is a way to keep track of your code for a project, while also allowing a team to work independently on the same project. It is a bit unintuitive to use; it combines using a web browser with command line functions (through the Mac terminal, or Windows Command Line).

Installing Git (one time only)

Macs: Install Xcode, which will include Git automatically
xcode-select --install

Windows: https://git-scm.com/download/win

To check to see if the installation was successful, run:
git --version

Getting onto GitHub (one time only)

  1. Create an account on GitHub https://github.com/
  2. Create a SSH key for GitHub: (Do this on each computer that you own (not in a computer lab) will be using regularly)
    https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=mac
    • Notice that there is a tab to change the instructions to Windows or Linux.
    • I recommend setting up a passphrase (a password) to secure your computer even more.
  3. Follow the "Generation a new SSH key" and the "Adding your SSH key to the ssh-agent" sections.
  4. Then, follow the "Adding a new SSH key to your GitHub account"
    https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
    • Key type: Authentication Key

Cloning the repository (the first time you are working with a new project, i.e. a new code repository)

  1. If needed, ask Eric for access to the proper repository.
  2. Log onto GitHub and navigate to the repository that you are working on. For example:
    https://github.com/MEE-Laboratory/single-species-simulation-eric-niki-and-yuko
  3. Clone the repository
    • Click on the green "<> Code" button
    • Select SSH
    • Copy the resulting link
    • On your terminal:
    git clone <clone link>


Making changes to a repository