Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit .gitignore in Jupyter Lab?

My .gitignore is not visible in Jupyter Lab Files tab. Is there any way to show hidden files there?

like image 237
Ivona Tau Avatar asked Sep 07 '18 12:09

Ivona Tau


2 Answers

This is still an open issue in JupyterLab:

https://github.com/jupyterlab/jupyterlab/issues/2049

As a temporary workaround, you can start your jupyter lab via the below command (as mentioned in the above URL) to edit hidden files:

jupyter lab --ContentsManager.allow_hidden=True
like image 119
chaooder Avatar answered Sep 23 '22 05:09

chaooder


JupyterLab currently lacks the ability to toggle hidden files in the browser.

You can simply rename the file in a terminal session to view/edit .gitignore as needed:

1) Create gitignore as TEXT file:

enter image description here

2) Rename file to gitignore (no preceding dot) in JupyterLab:

You can now view/edit in JupyterLab as needed.

3) Prior to pushing to GitHub, add the preceding dot by running the following in terminal:

mv gitignore .gitignore

Whenever you need to view/edit the file, change it back to visible:

mv .gitignore gitignore

...and edit the file using JupyterLab.

If you ever need to see the file listed, run the following in terminal:

ls -a
like image 34
Cybernetic Avatar answered Sep 25 '22 05:09

Cybernetic