Git and GitHub for DS

Published

May 1, 2020

Note: Changes have been made to this course since the video was recorded. The video is still relevant and will be updated in the future to reflect the changes. For conflicts of the video and the text, the text is the most current.

Setup Git and GitHub

GitHub will be used for publishing all projects

  1. Install git on your computer

    • Windows Installation Note: Keep all settings as default during installation
    • Mac Installation
      Note: Mac users can install git using homebrew by running brew install git in the terminal. You will need to install homebrew first if you don’t have it
  2. Create a GitHub Account with your BYUI-I email.

    • Use an appropriate username. It will be the name of your public profile and website in Project 6.
    • If you already have a GitHub account, you can add your BYUI-I email to your existing account. Go to Settings -> Emails -> Add email address and make it your primary email.
  3. Install GitHub Desktop

  4. Git a Course Work Portfolio in GitHub

    1. Use the Portfolio Template in Data Science GitHub repo
      • Navigate to the Course Work Portfolio in GitHub
      • Click the Green Button Use this template and select Create a new repository
      • Check the box to Include all branches

      • Select byui-math-dept as the Owner You should have been added to byui-math-dept by your teacher if you dont see it ask them to add you. This Org uses SSO with BYUI, if you dont have your BYUI email in your GitHub account you need to add it (account -> settings -> emails -> add email address) If you have performed all these steps and still dont see it look for a badge above Repository template that states Single sign-on to see results in the byui-math-dept organization. Follow that link to sign in with SSO then you will be able to choose byui-math-dept as the Owner

      • Name the repository as your GitHub username + _ + the current semester and yearall lowercase (see example in image above)
      • Select Private as the type of Repo, then click Create Repository
    2. Clone the repository to your computer
      • Click the <> Code menu
      • Click the Green Button <> Code and select Open with GitHub Desktop

      • Click the Button Open in Visual Studio Code
      • If it asks for a username and password, this is because your GitHub Desktop is not logged in to your GitHub account via SSO. Log out of your account in GitHub Desktop, be logged in in your browser to GitHub and make sure you can access the byui-math-dept org where you cloned your new portfolio. Then repete these instructions. It will log you back in to GitHub Desktop but this with with the SSO credentials
  5. If you forgot to Check the box to Include all branches in the previous step (otherwise skip to the next step): Create a new branch gh-pages

    1. Create a new branch gh-pages
      • Click the Branch: main button then view all branches
      • Click the New Branch button
      • Name the branch gh-pages and click the Green Button Create new branch
    2. Modify Pages Settings for Build and deployment from main to gh-pages:
      • Click the Settings tab
      • Scroll down to the Pages section in the left hand menu
      • Locate the Build and deployment section and change Branch from main to gh-pages and leave the right side as /root
  6. Update the _quarto.yml file in course work portfolio:

    1. update the title to includ your name
    2. update the site url to your published site url (this will be in the deployment section in GitHub)
    3. update the repo-url to your GitHub repository url
    4. update the issue-url to your GitHub issue url (its the same as the repo url but with /issues/new at the end)
    5. update the page-footer left to include your name (line 15)
    6. update the page-footer right href to include your LinkedIn url (line 18 - optional)
    7. Scroll to the bottom and change the theme light: and/or dark: to another theme (optional)
  7. Commit and Push the changes made to GitHub

    1. Push the changes to GitHub via GitHub Desktop
      • Make sure you have the correct repo selected in the top left

      • Type a commit message and click the Blue Button Commit to main

      • Click the Blue Button Push origin

      • If it gives you a big long error when you push, this is because your GitHub Desktop is not logged in to your GitHub account via SSO. Log out of your account in GitHub Desktop, and log right back in
    2. Confirm the GitHub Actions are working
      • Navigate to the repo in GitHub and click on the Actions tab
      • Confirm the Update _quarto.yml is working by the yellow circle turning to a green check circle (Note: this can take 3-5min)
  8. Fix for a common bug

    1. Fix for the main page loading the ReadMe.md file instead of the portfolio website
      • Run quarto publish gh-pages in the terminal of VS Code
Back to top