TIL: Git and Drive in Colab

TIL: Git and Drive in Colab
Photo by Ellipsis Drive / Unsplash

So, this is my first TIL blog post.

For people who don't know TIL; TILs are micro-essays for what I learned Today = Today I learned!

Ok, here's the problem: I couldn't import Git project repo into Colab.

Colab has a feature for upload your jupyter-notebook file from GitHub, but it's just for notebook not other utils :/

I solved this problem by clonning my repository and uploading into Google Drive and importing gdrive via commands below!

from google.colab import drive

drive.mount('/content/gdrive/', force_remount=True)

But, there's another problem occured; this project will be public eventually and I should find a way for people to download project files into their colab easily - probably with one or two lines of code

I find out that Colab has functionality to use all terminal commands in notebook, so clonning a repository from a GitHub is solved my problem right now.

 !git clone https://github.com/username/project.git
Don't forget to change your directory to reach project files within jupyter-notebook via `%cd ` command


Before git solution; I was using svn for installation of folder/git repo

!apt install subversion
!svn checkout https://github.com/username/project

It installs project into the content folder!