Created
March 2, 2024 20:53
-
-
Save Mhmd-Hisham/2a7de2f7a3bb8b97617db76dea193e5b to your computer and use it in GitHub Desktop.
Clone private GitHub repositories on Google Colab with a PSA (Personal Access Token)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import getpass\n", | |
| "\n", | |
| "repo_name = input(\"Enter the name of the repository: \")\n", | |
| "email = input(\"Enter your GitHub email: \")\n", | |
| "username = input(\"Enter your GitHub username: \")\n", | |
| "personal_access_token = getpass.getpass(prompt='Enter your personal access token: ')\n", | |
| "\n", | |
| "!git config --global user.email $email\n", | |
| "!git config --global user.name $username\n", | |
| "\n", | |
| "!git clone \"https://{username}:{personal_access_token}@github.com/{username}/{repo_name}\"\n", | |
| "\n", | |
| "%cd \"{repo_name}\"\n", | |
| "!git pull\n", | |
| "\n", | |
| "!ls" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "language_info": { | |
| "name": "python" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment