trainer.push_to_hub(**kwargs) requires "git pull" first
### System Info

Hi,
I am using the Segformer, following the tutorial https://huggingface.co/blog/fine-tune-segformer
Everytime aftern training the conflict error will come after executing the code "trainer.push_to_hub(**kwargs)".
Error messages:
! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://huggingface.co/yiming19/segformer-b0-finetuned-segments-construction-1'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I could use git pull and git push manually to push model, but why will this error come or before push the model can execute git pull first? 
@sgugger 

Thanks.

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

kwargs = {
    "tags": ["vision", "image-segmentation"],
    "finetuned_from": pretrained_model_name,
    "dataset": hf_dataset_identifier,
}

feature_extractor.push_to_hub(hub_model_id)
trainer.push_to_hub(**kwargs)


### Expected behavior

I just follow the tutorial https://huggingface.co/blog/fine-tune-segformer
Should no error come.
You either need to `--overwrite_output_dir` or make sure the `output_dir` you are using is a local clone of your repo that is up to date, yes.<|||||>Thanks to your fast reply. How could I change the code? Cause I donot want to pull and push in the terminal manually, want to 
 do "pull" firstly then "push" in the code example provided by the link.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.