Wuraola Oyewusi

← Back to Home
Technical Tutorial August 1, 2019

How to work with GitHub in Google Colaboratory Notebook

This is one of those things I'm writing because I didn't find exactly what I wanted when I needed the information.

Key Concept

One of the most important things to know about working in Colaboratory or Jupyter notebook is that all your Linux shell commands work. You only need to prepend a '!' before your code line or put the magic command '%%bash' at the beginning of your code snippet.

Using shell commands with exclamation mark Using bash magic command Working with git commands in Colab

What We'll Cover

We will set up GitHub, upload a file to a branch, then merge an upstream into GitHub fork—all from Colaboratory Notebook.

Set Up GitHub in Notebook Environment

Setting up GitHub

Initialize Git

Initializing git Git configuration

Working with Git Commands

Git commands in action

Conclusion

I hope this answers some of your questions. These are very few out of the available git commands. Don't forget to check status often with !git status and whatever you need to know more, it's somewhere on the internet.