Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Enregistrer un notebook sur GitHub
Pour sauvegarder votre instance de notebooks gérés par l'utilisateur et la mettre à disposition d'autres utilisateurs, enregistrez le contenu de votre instance de notebooks gérés par l'utilisateur dans GitHub.
Créer un dépôt GitHub
Si vous n'avez pas encore de dépôt GitHub, vous devez en créer un.
Lorsque vous créez votre dépôt GitHub, assurez-vous qu'il peut être cloné en cochant la case Initialize this repository with a README (Initialiser ce dépôt avec un fichier README).
Clonez votre dépôt GitHub dans votre instance de notebooks gérés par l'utilisateur
Pour cloner votre dépôt GitHub dans votre instance de notebooks gérés par l'utilisateur, procédez comme suit :
Dans votre dépôt GitHub, cliquez sur le bouton Code, puis sur l'onglet Local.
Copiez l'URL HTTPS.
Dans Google Cloud Console, accédez à la page Notebooks gérés par l'utilisateur.
Cliquez sur Ouvrir JupyterLab pour ouvrir votre instance de notebooks gérés par l'utilisateur.
Dans le Navigateur de fichiersfolder de JupyterLab, sélectionnez le dossier dans lequel vous souhaitez cloner le dépôt GitHub. Par exemple, le dossier de base.
Dans JupyterLab, sélectionnez Git > Cloner un dépôt.
Si vous y êtes invité, saisissez vos identifiants.
Si vous utilisez un nom d'utilisateur et un mot de passe GitHub, saisissez-les.
Si vous utilisez une authentification à deux facteurs avec GitHub, créez un jeton d'accès personnel et utilisez-le.
Dans la boîte de dialogue Cloner un dépôt, collez l'URL HTTPS de votre dépôt GitHub.
Cliquez sur Clone (Cloner).
Configurez votre instance de notebooks gérés par l'utilisateur avec vos informations utilisateur GitHub
Dans JupyterLab, sélectionnez Git > Ouvrir le dépôt Git dans le terminal pour ouvrir une fenêtre de terminal Git.
Dans la fenêtre du terminal Git, entrez les commandes suivantes pour configurer votre nom d'utilisateur et votre adresse e-mail Git :
Votre instance de notebooks gérés par l'utilisateur affiche votre dépôt en tant que nouveau dossier. Si vous ne voyez pas votre dépôt GitHub cloné sous forme de dossier, cliquez sur le bouton Actualiser la liste des fichiers.
Double-cliquez sur le dossier de votre dépôt pour l'ouvrir.
Ajoutez un nouveau notebook à votre instance de notebooks gérés par l'utilisateur.
Pour ajouter un fichier notebook, vous pouvez utiliser le menu ou le lanceur d'applications.
Menu
Pour ajouter un fichier notebook depuis le menu, sélectionnez File > New > Notebook (Fichier > Nouveau > Notebook).
Dans la boîte de dialogue Sélectionner le noyau, sélectionnez le noyau du nouveau notebook, par exemple Python 3, puis cliquez sur Sélectionner.
Le nouveau fichier notebook s'ouvre.
Lanceur d'applications
Pour ajouter un fichier notebook à partir du lanceur d'applications, sélectionnez Fichier > Nouveau > Lanceur d'applications.
Cliquez sur la tuile du noyau que vous souhaitez utiliser.
Le nouveau fichier notebook s'ouvre.
Renommez le nouveau fichier notebook.
Menu
Sélectionnez Fichier > Renommer le notebook. La boîte de dialogue Renommer le fichier s'ouvre.
Dans le champ Nouveau nom, remplacez Untitled.ipynb par un nom significatif, tel que install.ipynb.
Cliquez sur Renommer.
Lanceur d'applications
Cliquez avec le bouton droit sur l'onglet Untitled.ipynb, puis cliquez sur Renommer le notebook. La boîte de dialogue Renommer le fichier s'ouvre.
Dans le champ Nouveau nom, remplacez Untitled.ipynb par un nom significatif, tel que install.ipynb.
Cliquez sur Renommer.
Sélectionnez l'onglet Git. Votre nouveau notebook est répertorié dans le groupe
Non suivi.
Pour ajouter le nouveau notebook en tant que fichier dans votre dépôt GitHub, faites un clic droit sur le nouveau notebook et sélectionnez Suivre. Dans l'onglet Git, votre notebook est maintenant ajouté au regroupement par étapes.
Pour valider votre nouveau notebook dans votre dépôt GitHub, dans l'onglet Git, ajoutez un commentaire de validation et cliquez sur Valider.
Pour ouvrir une fenêtre de terminal Git, sélectionnez Git > Ouvrir le dépôt Git dans le terminal.
Dans la fenêtre du terminal Git, saisissez la commande git push.
Si vous utilisez un nom d'utilisateur et un mot de passe GitHub, saisissez-les lorsque vous y êtes invité.
Lorsque la commande git push se termine, vos fichiers validés se trouvent dans votre dépôt GitHub.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[],[],null,["# Save a notebook to GitHub\n=========================\n\n\n| Vertex AI Workbench user-managed notebooks is\n| [deprecated](/vertex-ai/docs/deprecations). On\n| April 14, 2025, support for\n| user-managed notebooks will end and the ability to create user-managed notebooks instances\n| will be removed. Existing instances will continue to function\n| but patches, updates, and upgrades won't be available. To continue using\n| Vertex AI Workbench, we recommend that you\n| [migrate\n| your user-managed notebooks instances to Vertex AI Workbench instances](/vertex-ai/docs/workbench/user-managed/migrate-to-instances).\n\n\u003cbr /\u003e\n\nTo back up your user-managed notebooks instance and make it available\nto others, save the contents of your user-managed notebooks instance\nto GitHub.\n\nCreate a GitHub repository\n--------------------------\n\nIf you don't already have a [GitHub](https://github.com/) repository, you must create one.\n\nWhen you create your GitHub repository make sure that your GitHub repository\ncan be cloned by selecting the **Initialize this repository with a README**\ncheckbox.\n\nClone your GitHub repository in your user-managed notebooks instance\n--------------------------------------------------------------------\n\nTo clone your GitHub repository in your user-managed notebooks\ninstance, complete the following steps:\n\n1. In your GitHub repository, click the **Code** button,\n and then click the **Local** tab.\n\n2. Copy the **HTTPS** URL.\n\n3. In the Google Cloud console, go to the **User-managed notebooks** page.\n\n [Go to User-managed notebooks](https://console.cloud.google.com/vertex-ai/workbench/user-managed)\n4. Click **Open JupyterLab** to open\n your user-managed notebooks instance.\n\n5. In the JupyterLab\n folder **File Browser**, select\n the folder where you want to clone the GitHub repository. For example,\n the home folder.\n\n6. In JupyterLab, select\n **Git \\\u003e Clone a Repository**.\n\n7. If prompted, enter your credentials.\n\n - If you use a GitHub username and password, enter your\n GitHub username and password.\n\n - If you use two-factor authentication with GitHub,\n create and use a [personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line).\n\n8. In the **Clone a repo** dialog, paste the HTTPS URL for your GitHub repository.\n\n9. Click **Clone**.\n\nConfigure your user-managed notebooks instance with your GitHub user information\n--------------------------------------------------------------------------------\n\n1. In JupyterLab, select\n **Git \\\u003e Open Git Repository in Terminal**\n to open a Git terminal window.\n\n2. In the Git terminal window, enter the following commands to configure\n your Git username and email:\n\n ```scdoc\n git config --global user.name \"YOUR_NAME\"\n git config --global user.email \"YOUR_EMAIL\"\n ```\n3. If your GitHub account requires SSH authentication, complete\n the following steps to connect your account:\n\n 1. From your Git terminal in your user-managed notebooks\n instance, follow GitHub's\n [instructions for generating a new SSH key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).\n\n 2. Follow the\n [instructions for adding that SSH key to your GitHub\n account](https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account).\n\n4. Close the Git terminal window.\n\nAdd your committed files to your GitHub repository\n--------------------------------------------------\n\n1. Your user-managed notebooks instance shows your repository\n as a new folder. If you don't\n see your cloned GitHub repository as a folder, click the **Refresh File\n List** button.\n\n2. Double-click your repository folder to open it.\n\n3. Add a new notebook to your user-managed notebooks instance.\n\n To add a notebook file, you can use the menu or the Launcher. \n\n ### Menu\n\n 1. To add a new notebook file from the menu, select\n **File \\\u003e New \\\u003e Notebook**.\n\n 2. In the **Select kernel** dialog, select the kernel for your new\n notebook, for example, **Python 3** , and then click **Select**.\n\n Your new notebook file opens.\n\n ### Launcher\n\n 1. To add a new notebook file from the Launcher, select\n **File \\\u003e New \\\u003e Launcher**.\n\n 2. Click the tile for the kernel you want to use.\n\n Your new notebook file opens.\n4. Rename your new notebook file.\n\n ### Menu\n\n 1. Select **File \\\u003e Rename notebook** . The\n **Rename file** dialog opens.\n\n 2. In the **New name** field, change `Untitled.ipynb` to something\n meaningful, such as `install.ipynb`.\n\n 3. Click **Rename**.\n\n ### Launcher\n\n 1. Right-click the `Untitled.ipynb` tab and then click\n **Rename notebook** . The **Rename file** dialog opens.\n\n 2. In the **New name** field, change `Untitled.ipynb` to something\n meaningful, such as `install.ipynb`.\n\n 3. Click **Rename**.\n\n5. Select the **Git** tab. Your new notebook is listed in the **Untracked**\n grouping.\n\n6. To add the new notebook as a file for your GitHub repository, right-click\n the new notebook and select **Track** . On the **Git** tab, your notebook\n is now added to the **Staged** grouping.\n\n7. To commit your new notebook to your GitHub repository, on the **Git** tab,\n add a commit comment and click **Commit**.\n\n8. To open a Git terminal window, select\n **Git \\\u003e Open Git repository in terminal**.\n\n9. In the Git terminal window, enter the `git push` command.\n\n - If you use a GitHub username and password, when prompted, enter your\n GitHub username and password.\n\n - If you use two-factor authentication with GitHub,\n [create a personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)\n to use.\n\n When the `git push` command completes, your committed files are in\n your GitHub repository."]]