Git and GitHub for DS
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
Install git on your computer
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.
Install GitHub Desktop
Git a Course Work Portfolio in GitHub
- 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 selectCreate a new repository
- Check the box to
Include all branches
- Select
byui-math-dept
as theOwner
You should have been added tobyui-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 aboveRepository template
that statesSingle 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 choosebyui-math-dept
as theOwner
- Name the repository as your GitHub
username
+_
+the current semester and year
all lowercase (see example in image above)
- Select
Private
as the type of Repo, then clickCreate Repository
- Navigate to the Course Work Portfolio in GitHub
- Clone the repository to your computer
- Click the
<> Code
menu - Click the Green Button
<> Code
and selectOpen 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
- Click the
- Use the Portfolio Template in Data Science GitHub repo
If you forgot to
Check the box to Include all branches
in the previous step (otherwise skip to the next step): Create a new branchgh-pages
- Create a new branch
gh-pages
- Click the
Branch: main
button thenview all branches
- Click the
New Branch
button
- Name the branch
gh-pages
and click the Green ButtonCreate new branch
- Click the
- Modify Pages Settings for Build and deployment from
main
togh-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
togh-pages
and leave the right side as/root
- Click the
- Create a new branch
Update the
_quarto.yml
file in course work portfolio:- update the
title
to includ your name - update the
site url
to your published site url (this will be in the deployment section in GitHub) - update the
repo-url
to your GitHub repository url - update the
issue-url
to your GitHub issue url (its the same as the repo url but with/issues/new
at the end) - update the
page-footer
left
to include your name (line 15) - update the
page-footer
right
href
to include your LinkedIn url (line 18 - optional) - Scroll to the bottom and change the theme
light:
and/ordark:
to another theme (optional)
- update the
Commit and Push the changes made to GitHub
- 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
- Make sure you have the correct repo selected in the top left
- 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)
- Navigate to the repo in GitHub and click on the
- Push the changes to GitHub via GitHub Desktop
Fix for a common bug
- 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
- Run
- Fix for the main page loading the ReadMe.md file instead of the portfolio website