Push Google Colab ipynb to Github?

You have likely come up with a solution to this by now, but I see that there is now a "Save copy to Github" feature in Colab, quoted from this blog post:

You can also easily save a copy of your Colab notebook to Github by using File > Save a copy to Github…


@jaymullr, have you managed to find your way?

Here is the tutorial how to easily setup your notebook from github to Google Colab using Clouderizer: Medium tutorial. Okay, maybe what you wanted is the other way around, google Colab to github. The exciting things is that using clouderizer allows you to do both! Sync your jupyter notebook, github, and Colab. My steps might seems rigorously long but it's actually really easy, one time setup for all. Here is how I do it (skip to Sync back to GitHub if you just wanna know the big picture of how):

Clouderizer for Google Colab Project

Prerequisites

  1. Sign Up for google/gmail account
  2. Sign up for Clouderizer account [link]
  3. Create a repository on your github and upload your project (all ipynb, py modules, and even dataset(zip it if < 1GB)) to your repo.

Setup Clouderizer Project

  1. Login to Clouderizer console. On first login, you will be prompted to link your Google Drive with Clouderizer. Follow on-screen instructions to do so. In case it doesn't prompt the link, you can configure your Google Drive by going to Clouderizer dashboard->sidebar menu->Clouderizer Drive. The Clouderizer will setup a folder called 'clouderizer' in your Google Drive to contain your ipynb project (be it Machine Learning or any)
  2. Go back to Clouderizer Dashboard. Then click new Project. As you follow the instruction, you can opt to load the whole github project that contains your ipynb work that you intend to upload to Google Colab.
  3. In step 5, you can include additional dataset you want to work on by specifying the URL for dataset (eg. from kaggle dataset URL). You can also opt and specify if you would like to refactor your project by having separate folder for dataset, main code/modules, and output files.
  4. Next, head to Google Colab/ create a Google Colab file anywhere in you Google Drive, then execute: !wget NS -content disposition 'https://to_whatever_link_you_get_to_console'
  5. Finally, go back to Clouderizer dashboard and check if your project environment is running already and synced to Google Colab. Then click on jupyter notebook icon in that dashboard, just right next to the title name of the project you give. Now, you can start doing your Machine Learning or whatever work you do as if you're doing it on local machine, then sync it immediately at Google Colab.
  6. Finally you will be able to verify if your .ipynb will work and able to import modules/datasets in Google Colab too. Just go back to Google Drive->clouderizer folder->your project. Then try to run and see if everything works as it is in jupyter notebook.

Sync back to github

  1. Nothing special here. Go back to Clouderizer jupyter notebook, open terminal in the root/top level directory and $git push origin master. That's it!

If you find my way interesting, hit upvote. However, this method might be too tedious at first. Let me know what you think! Clouderizer is free btw.