Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ ModelArts/ DevEnviron/ JupyterLab/ Using the Git Plug-in

Using the Git Plug-in

Updated on 2024-08-14 GMT+08:00

In JupyterLab, you can use the Git plug-in to clone the GitHub open-source code repository, quickly view and edit data, and submit the modified data.

Prerequisites

The notebook instance is running.

Starting the Git Plug-in of JupyterLab

In the notebook instance list, locate the target instance and click Open in the Operation column to go to the JupyterLab page.

Figure 1 shows the Git plug-in of JupyterLab.

Figure 1 Git plug-in

Cloning a GitHub Open-Source Code Repository

Access a GitHub open-source code repository at https://github.com/jupyterlab/extension-examplesitHub. Click , enter the repository address, and click OK to start cloning. After the cloning is complete, the code library folder is displayed in the navigation pane of JupyterLab.

Cloning a GitHub Private Code Repository

When you clone a GitHub private code repository, a dialog box will be displayed, asking you to enter your personal credentials. In this case, enter the personal access token in GitHub.

To obtain a personal access token, perform the following operations:

  1. Log in to GitHub and open the configuration page.
  2. Click Developer settings.
  3. Choose Personal access tokens > Generate new token.
  4. Verify the account.
  5. Describe the token, select permissions to access the private repository, and click Generate token to generate a token.
  6. Copy the generated token to CloudBuild.
NOTICE:
  • Save the token securely once it is generated. It will be unavailable after you refresh the page. If it is not obtained, generate a new token.
  • Enter a valid token description so that it can be easily identified. If the token is deleted by mistake, the building will fail.
  • Delete the token when it is no longer used to prevent information leakage.
Figure 2 Cloning a GitHub private code repository (only authorization using a personal access token is supported)

Figure 3 Obtaining a personal access token

Viewing a Code Repository

In the list under Name, double-click the folder you want to use and click the Git plug-in icon on the left to access the code repository corresponding to the folder.

Figure 4 Opening the folder and starting the Git plug-in
You can view the information current code repository, such as the repository name, branch, and historical submission records.
Figure 5 Viewing a code repository
NOTE:

By default, the Git plug-in clones the master branch. To switch another branch, click Current Branch to expand all branches and click the target branch name.

Viewing Modifications

If a file in the code repository has been modified, you can view the modified file under Changed on the Changes tab page. Click Diff this file on the right of the file name to view the modifications.

Figure 6 Viewing modifications

Committing Modifications

After confirming that the modifications are correct, click Stage this change on the right of the file name, which is equivalent to running the git add command. The file enters the Staged state. Enter the message to be committed in the lower left corner and click Commit that is equivalent to running the git commit command.

Figure 7 Committing modifications

On the History tab page, view the committing status.

Figure 8 Checking whether the committing is successful

Click the push icon, which is equivalent to running the git push command, to push the code to the GitHub repository. After the pushing is successful, the message "Successfully completed" is displayed. If the token used for OAuth authentication has expired, a dialog box is displayed asking you to enter the user token or account information. Enter the information as prompted. This section describes the authorization using a personal access token. If you use a password for authorization but the password becomes unavailable, perform the operations described in What Do I Do If the Git Plug-in Password Is Invalid?

Figure 9 Pushing code to the GitHub repository

After the preceding operations are complete, on the History tab page of the JupyterLab Git plug-in page, you can see that origin/HEAD and origin/master point to the latest push. In addition, you can find the corresponding information in the committing records of the GitHub repository.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback