Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colaboratory - access to private repository from github

in colaboratory i can excecute bash command with "!" simbol like bash !git clone repository-name for cloning github repository.

It's work perfectly when repository is public, but doesn't work when repository is private, because it request user name / password without a input. How could i solve this issue?

thank you a lot!

like image 623
Marco Scarselli Avatar asked Feb 28 '26 01:02

Marco Scarselli


2 Answers

Since 2021, Github has migrated from using username and password to using a Personal Access Token.

In order to clone your repository using a personal access token

  1. Navigate to https://github.com/settings/tokens
  2. Click on "Generate New Token", and provide the appropriate permissions an define the expiry date. Do assign a note for it for you to remember it's use, and click on generate token.
  3. Copy and keep the token saved with you in a secure space. 4 To clone the repo use->git clone https://<PERSONAL_ACCESS_TOKEN>@github.com/username/repo.git
like image 88
Hetarth Chopra Avatar answered Mar 02 '26 14:03

Hetarth Chopra


You can pass username and password from url itself:-

!git clone https://username:[email protected]/username/repository.git
like image 30
saurabheights Avatar answered Mar 02 '26 15:03

saurabheights