0

I am using ungit with datalab notebooks on google cloud platform. I would like to ignore directories which save model data. How to do this? I don't see any ui entries to do this.

netskink
  • 4,033
  • 2
  • 34
  • 46
  • What do you mean by "ignore directories"? I tested ungit UI following [this guide](https://cloud.google.com/datalab/docs/how-to/working-with-notebooks#using_ungit_in_your_browser) and the only way I see to prevent something from being committed is cancelling it using the X in the "files to commit" list. I don't see a way to specifically select a group of directories. – Rubén C. Jul 31 '18 at 14:13

2 Answers2

2

It doesn't seem like ungit provides a way to manage the .gitignore file. You could write a simple file by executing a shell script in any notebook cell such as: !echo ".ignoreme" > .gitignore Or you can use the Datalab text editor to edit the file.

yelsayed
  • 5,236
  • 3
  • 27
  • 38
  • thanks. I need to do something. The last time I did a commit I got a message about too many files changes. I'll let you know if your mod works tomorrow. Many thanks for the help! – netskink Aug 03 '18 at 00:43
1

Using this guide there is a section on how to ssh to the instance. In order to do that you need to start the compute instance associated with the datalab notebook. You can use the console to start it or simply connect to your datalab notebook. Either way will start the compute engine so you can ssh to the instance.

  1. Do the ssh command listed in step one of the guide.

  2. Do the docker command listed in step two of the guide.

  3. Open the interactive shell in the container listed in step three of the guide.

  4. Change directory to the root of the notebooks git repo as listed in step four of the guide.

  5. An editor is not included. I was able to apt-get install vim.

Edit the .gitignore file. It should have some entries already there. My code is in top-level directory named mine and my models are in model_trained so I added model_trained to the gitignore file. Without the leading or trailing directory slash it matches the model output dirs where ever they appear in the git file system.

The is the resulting .gitignore.

root@b28d8cf57173:~/datalab/notebooks# cat .gitignore 
.ipynb_checkpoints
*.pyc
model_trained

Afterwards, I trained the model, and checked with ungit.

netskink
  • 4,033
  • 2
  • 34
  • 46