How do I link a GitHub repository to a Google Colab notebook?

Viewed 7315

I have created a GitHub repository and I want to link it to my Colab notebook, but I am unable to do that. I have used the following command to get a clone of git repo:

! git clone link/to/your/repo

But I get this error:

fatal: repository 'link/to/your/repo' does not exist

Can someone please point out my mistake? Thanks!

2 Answers

When you use in Colab website:

You can simply go to Google Colab and you can choose 'GitHub' on the box which you can see when you just go to the Colab site and login. Colab will automatically redirect you to github in order to authorize your github account. Then you can choose repository to use at Google Colab!

When you use in local CLI:

You need to check out the URL that you provided in command. It MUST BE a valid git(hub) url.

Create a personal access token as mentioned here.

Once done, just call

pat = 'Token here'
!git clone https://{pat}@github.com/username/repo.git
Related