Managing Spaces with Github Actions
Managing Spaces with Github Actions
You can keep your app in sync with your GitHub repository with Github Actions. Remember that for files larger than 10MB, Spaces requires Git-LFS. If you don’t want to use Git-LFS, you may need to review your files and check your history. Use a tool like BFG Repo-Cleaner to remove any large files from your history. BFG Repo-Cleaner will keep a local copy of your repository as a backup.
First, you should set up your GitHub repository and Spaces app together. Add your Spaces app as an additional remote to your existing Git repository.
Copied
Then force push to sync everything for the first time:
Copied
Next, set up a GitHub Action to push your main branch to Spaces. In the example below:
Replace
HF_USERNAME
with your username andSPACE_NAME
with your Space name.Create a Github secret with your
HF_TOKEN
. You can find your Hugging Face API token under API Tokens on your Hugging Face profile.
Copied
Finally, create an Action that automatically checks the file size of any new pull request:
Copied
Last updated