Google Colaboratory is designed to integrate cleanly with GitHub, allowing both loading notebooks from github and saving notebooks to github.
Colab can load public github notebooks directly, with no required authorization step.
For example, consider the notebook at this address: https://github.com/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb.
The direct colab link to this notebook is: .
To generate such links in one click, you can use the Open in Colab Chrome extension.
Colab also supports special URLs that link directly to a GitHub browser for any user/organization, repository, or branch. For example:
googlecolab organization. Replace googlecolab with any other github org or user to see their repositories.colabtools repository within the googlecolab organization. Substitute any user/org and repository to see its contents.master branch of the colabtools repository within the googlecolab organization. (don't forget the blob here!) You can specify any valid branch for any valid repository.Loading a notebook from a private GitHub repository is possible, but requires an additional step to allow Colab to access your files. Do the following:
Any time you open a GitHub hosted notebook in Colab, it opens a new editable view of the notebook. You can run and modify the notebook without worrying about overwriting the source.
If you would like to save your changes from within Colab, you can use the File menu to save the modified notebook either to Google Drive or back to GitHub. Choose File→Save a copy in Drive or File→Save a copy to GitHub and follow the resulting prompts. To save a Colab notebook to GitHub requires giving Colab permission to push the commit to your repository.
Anybody can open a copy of any github-hosted notebook within Colab. To make it easier to give people access to live views of GitHub-hosted notebooks, colab provides a shields.io-style badge, which appears as follows:
The markdown for the above badge is the following:
[](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
The HTML equivalent is:
<a href="https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
</a>
Remember to replace the notebook URL in this template with the notebook you want to link to.
In [0]: