The [`Repository`] class has a [`~Repository.push_to_hub`] function to add files, make a commit, and push them to a repository. Unlike the `commit` context manager, you'll need to pull from a repository first before calling [`~Repository.push_to_hub`].  
For example, if you've already cloned a repository from the Hub, then you can initialize the `repo` from the local directory:  
```python
>>> from huggingface_hub import Repository
>>> repo = Repository(local_dir="path/to/local/repo")
```  
Update your local clone with [`~Repository.git_pull`] and then push your file to the Hub:  
```py
>>> repo.git_pull()
>>> repo.push_to_hub(commit_message="Commit my-awesome-file to the Hub")
```  
However, if you aren't ready to push a file yet, you can use [`~Repository.git_add`] and [`~Repository.git_commit`] to only add and commit your file:  
```py
>>> repo.git_add("path/to/file")
>>> repo.git_commit(commit_message="add my first model config file :)")
```  
When you're ready, push the file to your repository with [`~Repository.git_push`]:  
```py
>>> repo.git_push()
```