简体   繁体   中英

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

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM