fix: Race Condition when using Sagemaker Checkpointing and Model Repository
# What does this PR do?

Fixes #21586

With the following changes:

- Added `_add_sm_patterns_to_gitignore()` as a helper method in the Trainer class that will add the patterns used by the SageMaker Checkpointing feature in the .gitignore file when initializing the Model Repository.
- A condition in the `init_git_repo()` to check if we have an important SageMaker environment variable 

It also includes a fix in the huggingface_hub library in order to consider excluding patterns when defining large files: https://github.com/huggingface/huggingface_hub/pull/1339

## Before submitting

- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [x] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?

## Who can review?

@sgugger as we discussed this issue in the https://github.com/huggingface/transformers/issues/21586
_The documentation is not available anymore as the PR was closed or merged._<|||||>Perfect, you just need to run `make style` on your branch with our quality tools installed and we should be good to merge!<|||||>> Perfect, you just need to run `make style` on your branch with our quality tools installed and we should be good to merge!

ok, let me do that so.<|||||>@sgugger sorry for the delay, some meetings here :/

it's done