Issue uploading model: "fatal: cannot exec '.git/hooks/pre-push': Permission denied"

Hi there,
I’m trying to upload my first model to the model hub. I’ve followed step-by-step the docs here, but encountered different issues:

  • I got it to sort of work on my local machine, but it was extremely slow (20~kbit per sec) and I had to abandon it. I saw this topic and that git lfs install is important, but it still doesn’t work.
  • Now I’ve retried it on a google colab and there I’m getting the following error when I !git push :
    fatal: cannot exec '.git/hooks/pre-push': Permission denied.

Here is a colab with my exact code: https://colab.research.google.com/drive/1OSJh4GySF_m3RZTPerXtBlNltMjv3hQy?usp=sharing
Uploading via colab is more important/convenient for me because I’m also training via colab.

Would be great if someone could tell me what I’m doing wrong in the colab (I’m new to using git) and I’m looking forward to adding my first models to the hub :slight_smile:

1 Like

Hi @MoritzLaurer, the doc could be improved but in your notebook it looks like you have two git repos (one you create with git init, the other you clone from huggingface.co) whereas you only should have one.

Here’s a minimal Colab here: https://colab.research.google.com/drive/1TFgta6bYHte2lLiQoJ0U0myRd67bIuiu?usp=sharing

Let me know if this solves your issue.

@sgugger I think we might want to remove the “and your clone is setup with the right remote URL” clause from the doc as it seems to be more confusing than helpful, what do you think? Maybe we can also link to my Colab above as a self-contained example of how to push from a Colab notebook.

1 Like

(Also cc’ing @pierric for info)

Thanks so much @julien-c , I followed the code in your colab and it works! Very happy about my first model (now living here) and I’ll add a model card with a proper description, metrics etc soon :slight_smile:

Just FYI: I think that the error fatal: cannot exec '.git/hooks/pre-push': Permission denied comes up when I put the model in a folder in my google drive, other than the default “/content” folder. When I don’t change the directory and just upload my model in the default “/content” folder (as you did), I don’t get the error. But when I try to upload it from another folder within colab, the error comes up. Here is a colab with your code slightly altered that produces the error and this is probably the problematic line of code:

from google.colab import drive
drive.mount('/content/drive')
%cd /content/drive/My\ Drive/Colab\ Notebooks/results/ 

The issue is a bit inconvenient, but I know that’s not an issue with Transformers (might be useful to know for other people who try to change directory).

Happy to do the change to the doc! Could you push your notebook in the notebooks repo so we can link it (through colab) from there? Afraid the random link might disappear some day.

I also have this error but I don’t think I have 2 repos.
I also get an error during the commit:
fatal: cannot exec '.git/hooks/post-commit': Permission denied
What’s wrong with my notebook?