Introduction to Github and Colab#
Github is a website used for version control (i.e., keeping track of file changes over time). When writing code, version control is essential for saving progress and retaining a history of updates. In this class we will be using GitHub for uploading homeworks and other assignments for submission. As you may already know, this course has a GitHub page for hosting class materials (CoAxLab/BiologicallyIntelligentExploration).
Colab (formally “Google Colaboratoy”) is a website for writing and running code in a convenient, interactive, and visually-useful fashion. Specifically, the format of code used on Colab is a “Jupyter Notebook” (see more info here if you are interested). This lab is actually built as a Jupyter notebook. You can run Jupyter notebooks on your own machine if you like, but for ease, we will be using Colab to run and write code in this class.
In this class you will need to set up a Github repository for keeping track of your labs. It will also help to connect it with Google Golab (your Andrew account should give you access to both).
To do this, just follow the steps below.
How to submit your completed lab notebooks#
Step 1: Set up a GitHub repository#
Create a GitHub account if you do not have one. It is recommended, though not required, that you use your Andrew account for this as it will give you more features to work with.
Create a private reposity with the name <your_last_name>_BIX_F24 (e.g.,
Burgess_BIX_F24
).Add the users
coaxlab0
(that’s a zero at the end) and the current TA’s username as collaborators to your repository.Note: This repository will be where you post your homeworks and other assignments throughout the semester.
Step 2: Set up Colab and connect with GitHub#
Navigate to the Google Colaboratory website and sign in with a Google account (you may want to use your school account to keep your class notebooks separate from your personal ones, but this is up to you).
In the starting menu, select the “GitHub” tab.
If there is a pop-up error, click the “retry” button.
Check the “Include private repos” checkbox in the menu. Note: you can choose to make your repo public as well if you’d prefer.
Go through the resulting screens to authorize Google Colab to connect with your GitHub account.
Choose your new private class respository from the drop-down in the Colab menu (you may need to refresh or log in again for your private repos to show up).
You should now be able to the paths of files in your new repository (if there are any) in the Colab menu.
If you’d like more information on connecting GitHub and Colab, see the demo Using Google Colab with GitHub.
Step 3: Save your notebook to GitHub#
When you save a notebook on Colab, it will be saved to your Google account (it won’t automatically be saved to GitHub).
To save your notebook to GitHub, click “File” and select the “Save a copy in GitHub” option.
in the “Copy to GitHub” menu, make sure your private class repository is selected.
Make sure to change the commit message line to something meaningful like “Added text cell for first commit” (you will always want to do this - when you save multiple versions of a notebook to GitHub, the messages will help you easily remember and find what you changed with each “commit” should you look back at older file versions).
You should now be able to find your notebook file in your private class repo!
(Note: you can also do this by having your GitHub repository cloned onto your computer, saving the notebook there, and then pushing to GitHub).
Step 4: Submit your GitHub-hosted notebook#
Follow these steps to submit a GitHub link of your filled out notebook via Canvas.
Log in to your school Canvas account.
Click on the “Assignments” tab of the navigation panel.
Click on the relevant Assignment that you are submitting (e.g.,
Lab 1 - Random explroation
)Click “Start Assignment”
Paste the URL to your notebook on Github into the field labled “Website URL:”.
Click Submit Assignment”
Click “the “Inbox” tab of the navigation panel.