Failed to push model repo
Author: mymusise
Pull request: no

Hi, when I upload my model to hub as the [new document](https://huggingface.co/transformers/model_sharing.html) say, I got this error:
```
Delta compression using up to 16 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 1.07 GiB | 3.08 MiB/s, done.
Total 4 (delta 0), reused 1 (delta 0)
remote: 
remote: -------------------------------------------------------------------------
remote: Your push was rejected because it contains files larger than 10M.
remote: Please use https://git-lfs.github.com/ to store larger files.
remote: -------------------------------------------------------------------------
remote: 
remote: Offending files:
remote:  - tf_model.h5 (ref: refs/heads/main)
To https://huggingface.co/mymusise/gpt2-medium-chinese
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://huggingface.co/mymusise/gpt2-medium-chinese'
```

## Environment info

- `transformers` version: 3.5.0
- Platform: Ubuntu 18.04


Comments:
And `git-lfs` is already installed in my local.
```bash
$ git lfs install
Updated git hooks.
Git LFS initialized.
```

What should I do?

Well, it's magical. It works if I clone it again. But this time is different from the first time.

- The first time, the model file seems not complete.
```bash
/data2/wiki_zh ⌚ 1:44:35
$ git clone https://huggingface.co/mymusise/gpt2-medium-chinese
Cloning into 'gpt2-medium-chinese'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 15 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (15/15), done.

/data2/wiki_zh ⌚ 1:44:50
$ cd gpt2-medium-chinese

/data2/wiki_zh/gpt2-medium-chinese on  main ⌚ 1:44:56
$ ls
config.json  tf_model.h5  vocab.txt

/data2/wiki_zh/gpt2-medium-chinese on  main ⌚ 1:44:56
$ ls -lh
total 44K
-rw-rw-r-- 1 mymusise mymusise 849 11月 13 01:44 config.json
-rw-rw-r-- 1 mymusise mymusise 135 11月 13 01:44 tf_model.h5
-rw-rw-r-- 1 mymusise mymusise 35K 11月 13 01:44 vocab.txt
```

- When I clone model repo again, the model file seems complete.

```bash
/data2/wiki_zh ⌚ 2:40:12
$ rm -rf gpt2-medium-chinese

/data2/wiki_zh ⌚ 2:40:16
$ git clone https://huggingface.co/mymusise/gpt2-medium-chinese  
Cloning into 'gpt2-medium-chinese'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 15 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (15/15), done.

/data2/wiki_zh/gpt2-medium-chinese on  main ⌚ 2:43:08
$ ls -lh 
total 1.2G
-rw-rw-r-- 1 mymusise mymusise  849 11月 13 02:40 config.json
-rw-rw-r-- 1 mymusise mymusise 1.2G 11月 13 02:42 tf_model.h5
-rw-rw-r-- 1 mymusise mymusise  35K 11月 13 02:40 vocab.txt
```

Then I can push model successfully when I update the model file.

I think, the reason why I push fails may be because I haven't added git-lfs before I `git add` the model file for the first time. `git lfs install` may not work after adding a big model file.

Yes, you need to run `git lfs install` before adding files. I'll make that clearer in the documentation

alternatively your can use ``` git lfs migrate import --everything ``` even before adding file without lfs. This will reindex files and let you push them using git lfs

will add this to my upcoming video about `git-lfs` @jqueguiner ❤️ 

I have to admit I'm lazy sometimes
![image](https://user-images.githubusercontent.com/690878/118976843-c9082b00-b975-11eb-9274-650595fd419d.png)


Maybe this one could help (for future searchers ;) )
```
huggingface-cli lfs-enable-largefiles
```
I had the same problem and was curious why it's working from Trainer that uses huggingface_hub
and found that need to run "huggingface-cli lfs-enable-largefiles"
https://github.com/huggingface/huggingface_hub/blob/2e81cf3ec04b0dd5ce2acc92d25f8261a8484f3e/src/huggingface_hub/commands/lfs.py#L45
```
This should be executed once for each model repo that contains a model file >5GB. It's documented in the error
    message you get if you just try to git push a 5GB file without having enabled it before.
```