Why am i getting KeyError 'email'?

I tried to clone the repository and it was successful but after the clone was successful a KeyError email occurred
what do I have to do ?

I am getting same error.

from transformers.keras_callbacks import PushToHubCallback
from tensorflow.keras.callbacks import TensorBoard

tensorboard_callback = TensorBoard(log_dir="./ic_from_scratch_model_save/logs")

push_to_hub_model_id = "{}/convnext-tiny-224-finetuned-class-example".format(user)

push_to_hub_callback = PushToHubCallback(
    output_dir="./ic_from_scratch_model_save",
    hub_model_id=push_to_hub_model_id,
    tokenizer=feature_extractor
)

I logged using notebook login

from huggingface_hub import notebook_login

notebook_login()

and git lfs. I am working on Colab.

%%capture
!git lfs install
!git config --global credential.helper store

My version of transformers is 4.41.2.

Pinging @Wauplin here

For context, Repository is a legacy class to handle repositories on the Hub. Here is a small guide explaining why you should avoid using it. Regarding why you have a KeyError on whoami()["email"], it might be due to the fact the token you are using don’t have the permission to access the user’s email. That can be the case if using an OAuth token in a Space for instance and that the permission is not granted (or that you are using a finegrained token).

I opened a PR to fix this in the future: Fix Repository if whoami call doesn't return an email by Wauplin · Pull Request #2320 · huggingface/huggingface_hub · GitHub. In the meantime, try to avoid using Repository or if you have to, pass a git_user/git_email as argument when instantiating the Repository object.