# github-upload > Upload local folders or files to GitHub using gh + git: create a new repository, push to an existing repository, convert nested git repos into proper submodules, or upload a file as a GitHub Gist. Use when the user asks to publish a local project (e.g., blog/Hugo site), upload a folder to GitHub, push a directory to a new repo, add/commit/push files to an existing repo, or share a file via gist. - Author: Rorance - Repository: luoz76070-art/my-skill - Version: 20260122123104 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/luoz76070-art/my-skill - Web: https://mule.run/skillshub/@@luoz76070-art/my-skill~github-upload:20260122123104 --- --- name: github-upload description: "Upload local folders or files to GitHub using gh + git: create a new repository, push to an existing repository, convert nested git repos into proper submodules, or upload a file as a GitHub Gist. Use when the user asks to publish a local project (e.g., blog/Hugo site), upload a folder to GitHub, push a directory to a new repo, add/commit/push files to an existing repo, or share a file via gist." --- # Github Upload ## Overview Use `scripts/gh_upload.py` to publish a local directory to GitHub, push updates, upload files into a repo at a specific path, or create a secret gist. Defaults required by user preferences: - Git remote name: `origin` - Gist default: `secret` - Repo visibility: ask every time (no silent defaults) ## Workflow Decision Tree 1. Decide what the user is trying to do: - **Just upload something with minimal prompts?** Use `upload` - **Publish a folder as a repo?** Use `publish-folder` - **Push an existing local git repo to an existing GitHub repo?** Use `push-existing` - **Upload one or more files into a repo path and push?** Use `upload-files` - **Share a file quickly (no repo) ?** Use `gist` 2. Always validate prerequisites before running automation: - `git` installed - `gh` installed - `gh auth status` shows a logged-in account ## Commands All commands are implemented by `scripts/gh_upload.py`. Prefer running it via `python3`. ### Auto Upload (Minimal Prompts) Use when the user wants a single command that "does the right thing". ```bash python3 scripts/gh_upload.py --dry-run upload --path "/absolute/path/to/file-or-folder" python3 scripts/gh_upload.py upload --path "/absolute/path/to/file-or-folder" --open ``` Default behavior: - Folder: create repo if `origin` is missing, visibility defaults to `public`, repo name defaults to folder name - File inside a git repo: commit that file and push to `origin` - File outside a git repo: create a secret gist - Nested repo without `origin`: ignore ### Publish Folder To New Repo Use when the user has a local folder and wants it on GitHub (create repo + push). ```bash python3 scripts/gh_upload.py publish-folder --path "/absolute/path/to/project" --open ``` Notes: - The script prompts for: `owner`, `repo`, `visibility` (public/private). - The script detects nested git repos and converts them to submodules when possible. ### Push Local Repo To Existing GitHub Repo Use when the user already has a GitHub repo and wants to set `origin` and push. ```bash python3 scripts/gh_upload.py push-existing --path "/absolute/path/to/repo" --owner "OWNER" --repo "REPO" --open ``` ### Upload Files Into A Repo And Push Use when the user wants to add one or more files to a repo and push. If the source file is outside the repo, require `--dest` (repo-relative path). ```bash python3 scripts/gh_upload.py upload-files \ --repo-path "/absolute/path/to/repo" \ --files "/abs/path/a.png,/abs/path/notes.md" \ --dest "uploads/" \ --message "Add uploads" \ --open ``` ### Upload File As Secret Gist Use when the user wants to share a single file quickly. ```bash python3 scripts/gh_upload.py gist --file "/absolute/path/to/file" --open ``` ## References - Common failures and fixes: `references/troubleshooting.md` - Security checklist for accidental secrets: `references/security-checks.md` ## Resources This skill includes example resource directories that demonstrate how to organize different types of bundled resources: ### scripts/ Executable code (Python/Bash/etc.) that can be run directly to perform specific operations. **Examples from other skills:** - PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation - DOCX skill: `document.py`, `utilities.py` - Python modules for document processing **Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations. **Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments. ### references/ Documentation and reference material intended to be loaded into context to inform Claude's process and thinking. **Examples from other skills:** - Product management: `communication.md`, `context_building.md` - detailed workflow guides - BigQuery: API reference documentation and query examples - Finance: Schema documentation, company policies **Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working. ### assets/ Files not intended to be loaded into context, but rather used within the output Claude produces. **Examples from other skills:** - Brand styling: PowerPoint template files (.pptx), logo files - Frontend builder: HTML/React boilerplate project directories - Typography: Font files (.ttf, .woff2) **Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output. --- **Any unneeded directories can be deleted.** Not every skill requires all three types of resources.