Skip to content

Authenticate with GitHub in Google Colab to access private repo.

License

Notifications You must be signed in to change notification settings

leonardschneider/colab-github

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Access GitHub Private Repo in Google Colab

Open In Colab

Authenticate with GitHub in Google Colab to access private repo.

Steps

  • Run the following code inside the colab notebook.
!wget -q https://raw.githubusercontent.com/leonardschneider/colab-github/main/colab_github.py
import colab_github
colab_github.github_auth(persistent_key=True)

Note that by setting persistent_key to true, you will be asked to connect to Google Drive, so this script will store private key inside your .colab-github folder of your Google Drive. Doing so, you only need to upload your private key to Github once.

  • You will see outputs like:
Please go to https://github.com/settings/ssh/new to upload the following key:  
ssh-ed25519 xxxxxxx/xxxxxxxxxxxxxxxxxxxx root@xxxxxxxxxxxxxxxx

Upload this public key to either your SSH settings, or your repo's Deploy Keys.

  • Use SSH method to clone your private repo. Inside the notebook, you can run
!git clone git@github.com:<your_username>/<your_private_repo>.git

About

Authenticate with GitHub in Google Colab to access private repo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.7%
  • Jupyter Notebook 42.3%