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.
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)
Select "AI Platform" from the GCP hamburger menu (menu on the left).
Then select your notebook and create an instance.
Create a new folder as shown below. This time, I created a directory called Qiita_notebook manually.
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.
① 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.
Go to the Qiita repository, open test.txt, and add as below → Save and close.
It will be manual, but now I will cut Qiita.ipynb outside the Qiita repository and paste it to the Qiita repository.
If you type the command as below, it will be pushed to GSR!
I was able to push from jupyter Lab safely!
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