fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.9k stars 487 forks source link

hooks folder inside .git must be manually created before nbdev_install_git_hooks #230

Closed Anacron-sec closed 4 years ago

Anacron-sec commented 4 years ago

Platform for reproduction: Paperspace gradient - P5000 Free GPU - FastAI template

I was following the tutorial at https://nbdev.fast.ai/tutorial.html to develop my own library and when i run nbdev_install_git_hooks as stated in "Install git hooks" section i run into the following error:

Traceback (most recent call last):
  File "/opt/conda/envs/fastai/bin/nbdev_install_git_hooks", line 8, in <module>
    sys.exit(nbdev_install_git_hooks())
  File "/opt/conda/envs/fastai/lib/python3.8/site-packages/fastscript/core.py", line 76, in _f
    func(**args.__dict__)
  File "/opt/conda/envs/fastai/lib/python3.8/site-packages/nbdev/cli.py", line 337, in nbdev_install_git_hooks
    with open(fn, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/notebooks/.git/hooks/post-merge'

After i created manually the .git/hooks folder the error went away and the command returned the following, as it's supposed to be:

Executing: git config --local include.path ../.gitconfig
Success: hooks are installed and repo's .gitconfig is now trusted
jph00 commented 4 years ago

That's odd - normally those are created for you. I'll add a check.