Spaces:
Runtime error
Download README.md from officialcyber88/Hugging-Face-To-Github-Transfer: direct link, hf CLI and curl.
- Browser
- Download file 3.54 kB
-
https://huggingface.co/spaces/officialcyber88/Hugging-Face-To-Github-Transfer/resolve/main/README.md
- Command line
-
hf download hf://spaces/officialcyber88/Hugging-Face-To-Github-Transfer/README.md
-
curl -L -o README.md https://huggingface.co/spaces/officialcyber88/Hugging-Face-To-Github-Transfer/resolve/main/README.md
A newer version of the Gradio SDK is available: 6.32.0
title: Hugging Face To Github Transfer
emoji: 🧪
colorFrom: red
colorTo: gray
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: unlicense
short_description: Repo Transfer
Hugging Face to GitHub Transfer
This tool allows you to transfer a Hugging Face model repository to a new GitHub repository with ease, using a simple web interface built with Gradio. It automates cloning the Hugging Face repo, creating a GitHub repo, and pushing the code, while handling authentication securely via a token.env file.
Features
- Clone any Hugging Face repository via its
.gitURL. - Create a new GitHub repository (public or private).
- Push the cloned repo to GitHub under your account.
- Supports specifying GitHub branch and repo visibility.
- Upload or generate a
token.envfile for secure token management. - Validates GitHub token scopes and provides detailed error messages.
- Simple web UI with Gradio for easy use.
Getting Started
Requirements
- Python 3.7+
- Git installed and accessible from your command line
- A GitHub Personal Access Token (classic token) with the
reposcope enabled.
GitHub Token Setup
Generate a classic token with the following permissions:
- repo (full control of private repositories)
Copy the generated token (starts with
ghp_and is 40 characters long).Optionally, create a file named
token.envwith the following content:GITHUB_TOKEN=your_github_token GITHUB_USERNAME=your_github_username GIT_USER_NAME=Your Name GIT_USER_EMAIL=you@example.com REPO_VISIBILITY=public GIT_BRANCH=main
Running the Tool
Simply run the script. It will launch a local Gradio web app.
python your_script_name.py
Using the Interface
- You can upload your
token.envfile to autofill your credentials and settings, or manually input them. - Provide the Hugging Face repo URL (e.g., https://huggingface.co/username/model.git).
- Enter a name for the new GitHub repo.
- Fill in or verify GitHub username, token, commit author name/email.
- Select the branch and visibility for the new GitHub repo.
- Click Start Transfer to begin the process.
- After completion, download the generated
token.envfile for future use.
Example token.env
GITHUB_TOKEN=ghp_yourtokenhere1234567890abcdef12345678 GITHUB_USERNAME=yourgithubusername GIT_USER_NAME=Your Name GIT_USER_EMAIL=youremail@example.com REPO_VISIBILITY=public GIT_BRANCH=main
Troubleshooting
- Token validation fails: Ensure your token is valid, has repo scope, and is not expired.
- Rate limit exceeded: Wait for the reset time or use a token with higher limits.
- Branch not found on remote: The branch you selected may not exist yet; you can still push to create it.
- Git not installed: Install Git and make sure it’s in your system PATH.
- Repo already exists: The tool will continue and push changes to the existing repo.
Security Notes
- Your GitHub token is only stored locally in the
token.envfile you upload or download. - Never share your token with others.
- Use tokens with the least privileges needed, and set expiration if desired.
License
This script is open-source and free to use.
Contact
For questions or issues, please open an issue or contact the maintainer.
Enjoy seamless transfer from Hugging Face to GitHub!
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference