[PYTHON] How to Git from GCP's Jupyter Lab to GSR

1. Purpose

Recently, I've become accustomed to the basic sequence of add, commit, push from cloud shell to GSR on GCP, but since the actual development is often done with jupyter Lab, not from cloud shell. I thought it would be convenient to be able to push from Jupyter Lab, so I summarized the basic flow.

Specifically, we will launch a notebook from GCP's AI Platform.

2. Let's try it immediately

(1) Create a repository first

I created a repository called "Qiita" on GSR and pushed "test.txt" from the cloud shell in advance. (The following is the screen of GSR's Qiita repository)

キャプチャ2.PNG

(2) Launch of Jupyter Lab

Select "AI Platform" from the GCP hamburger menu (menu on the left).

Then select your notebook and create an instance.

キャプチャ1.PNG

(3) Creating a directory

Create a new folder as shown below. This time, I created a directory called Qiita_notebook manually.

キャプチャ3.PNG

(4) Create a notebook for Git → Clone from GSR

Create a notebook in the Qiita_notebook directory created in (3). This time it is "Qiita.ipynb".

In this notebook, type the command as follows.

キャプチャ4.PNG

① Initial setting This is the same flow as normal Git.

② Clone Clone the GSR Qiita repository

→ When you execute this, the "Qiita" repository will be cloned suddenly as shown in ③ of the above capture.

(5) Try to modify the text file

Go to the Qiita repository, open test.txt, and add as below → Save and close.

キャプチャ5.PNG

(6) Move Qiita.ipynb into the Qiita repository

It will be manual, but now I will cut Qiita.ipynb outside the Qiita repository and paste it to the Qiita repository.

キャプチャ6.PNG

(7) Finally push

If you type the command as below, it will be pushed to GSR!

キャプチャ7.PNG

(8) Confirm with GSR

I was able to push from jupyter Lab safely!

キャプチャ8.PNG

3. Conclusion

What did you think. I've only recently started learning Git, so I didn't know I could push from the jupyter lab (notebook). After this, I would like to learn and post about branching, merging, and conflict resolution!

Recommended Posts

How to Git from GCP's Jupyter Lab to GSR
How to instantly launch Jupyter Notebook from the terminal
How to use jupyter lab in Windows 10 local environment
How to change Jupyter layout
How to use Jupyter Notebook
You may need git to install the jupyter lab extension
How to use SWIG from waf
Run Open Modelica from Jupyter Lab
How to launch Explorer from WSL
How to access wikipedia from python
How to convert from .mgz to .nii.gz
Review from git init to git push
How to create a clone from Github
How to easily convert format from Markdown
How to create a git clone folder
Execute a script from Jupyter to process
How to update Google Sheets from Python
[TF] How to use Tensorboard from Keras
How to utilize multi-core from multiple languages
How to execute commands in jupyter notebook
How to access RDS from Lambda (python)
How to operate Linux from the console
Jupyter Notebook Basics of how to use
How to create a repository from media
How to access the Datastore from the outside
How to use GCP's Cloud Vision API
How to use Jupyter notebook [Super Basic]
How to use "Jupyter Book" to create publication quality books and documents from .ipynb
How to upload with Heroku, Flask, Python, Git (4)
[Jupyter Notebook / Lab] 3 ways to debug on Jupyter [Pdb]
How to open a web browser from python
How to hold a competition at Coda Lab
Study from Python Hour7: How to use classes
How to make multiple kernels selectable on Jupyter
How to get results from id in Celery
[Python] How to read data from CIFAR-10 and CIFAR-100
How to generate a Python object from JSON
How to call Cloud API from GCP Cloud Functions
How to operate Linux from the outside Procedure
How to handle Linux commands well from Python
How to extract coefficients from a fractional formula
How to measure line speed from the terminal
I read "How to make a hacking lab"
From easy git installation to docker startup python
Learn how to inflate images from TensorFlow code
How to clone github remote repository from atom
Jupyter Lab begins
Steps to attach and debug from VS Code to Jupyter Lab on a remote server
[Python] How to remove duplicate values from the list
How to create an article from the command line
How to use Keras ~ From simple model generation to CNN ~
How to scrape image data from flickr with python
Automatic data migration from yahoo root lab to Strava
How to upload with Heroku, Flask, Python, Git (Part 3)
How to install Git GUI and Gitk on CentOS
How to use Azure Table storage from Django (PTVS)
Backtrader How to import an indicator from another file
How to hold a hands-on seminar using Jupyter using docker
How to upload with Heroku, Flask, Python, Git (Part 1)
How to download files from Selenium in Python in Chrome
How to change static directory from default in Flask