Github/Github-Pages provider for Strapi CMS file upload.
npm install strapi-provider-upload-github
- Make sure git is installed and accessable at runtime on server.
- Avoid using code repo for uploading assets.
- Given empty branch should not contain any files.
./extensions/upload/config/config.json
{
"provider": "github",
"providerOptions": {
"repo": "https://github.com/user-name/site-assets",
"user": "user-name",
"token": "***token***",
"emptyBranch": "upload",
"baseBranch": "master",
"publicUrl": "https://user-name.github.io/site-assets",
"sizeLimit": 1000000
},
}
- repo - github repo link
- user - github user name
- token - github user token (Creating a personal access token - GitHub Docs)
- emptyBranch - branch name with no files (Empty branch used to auto merge uploaded files without any conflicts).
- baseBranch - branch name pointed to github pages.
- publicUrl - github pages public url. (alternatively you can use public urls from vercel, surge, netlify)
- sizeLimit - upload file size limit.