Improve error message when push to hub fails because it is not a git repo
See original GitHub issueIs your feature request related to a problem? Please describe.
I can’t figure out which folder I need to modify to get a push_to_hub
to work. I would like to improve the already excellent error message:
/usr/lib/python3.8/site-packages/huggingface_hub/repository.py in clone_from(self, repo_url, token)
760 # Check if the folder is the root of a git repository
761 if not is_git_repo(self.local_dir):
--> 762 raise EnvironmentError(
763 "Tried to clone a repository in a non-empty folder that isn't a"
764 " git repository. If you really want to do this, do it"
OSError: Tried to clone a repository in a non-empty folder that isn't a git repository. If you really want to do this, do it manually:
git init && git remote add origin && git pull origin main
or clone repo to a new folder and move your existing files there afterwards.
OSError: Tried to clone a repository in a non-empty folder that isn't a git repository. If you really want to do this, do it manually:
git init && git remote add origin && git pull origin main
or clone repo to a new folder and move your existing files there afterwards.
Describe the solution you’d like
I would like the self.local_dir
variable to be interpolated into the error message:
"Tried to clone a repository in a non-empty folder that isn't a"
f" git repository ('{self.local_dir}'). If you really want to do this, do it"
Describe alternatives you’ve considered
None
Additional context
None
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Fix 'failed to push some refs to' Git Errors - Komodor
If you get a failed to push some refs to error, the main thing to do is git pull to bring your local...
Read more >Not a git repository" when attempting to remote add a Git repo
In my case, I came across this error when running "git status" in a repo whose ownership was set to root:root. Running "git...
Read more >Git error - Fatal: Not a git repository and how to fix it | Datree.io
This error means you attempted to run a Git command, but weren't inside a Git repository. Make sure you've: Navigated to the right...
Read more >Fix Git's 'fatal: repository not found' error quickly | TheServerSide
Frustrated by Git's 'fatal: repository not found' error message? Here are five ways to fix that problem and successfully clone, fetch and ......
Read more >Raise exception when git push fails · Issue #621 - GitHub
Having to perform bit operations on flags is very unintuitive. The command line git client fails when push fails.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Happy to implement the suggested fix
Ok, thanks for the input 😃 I approved the PR. Have a nice weekend.