git-repo-detection
Detect GitHub repo owner/name from git remotes. Use when needing the owner/repo identifier for GitHub CLI or API calls, especially across multiple repos.
What this skill does
# Git Repository Detection ## When to Use This Skill | Use this skill when... | Use the alternative when... | |---|---| | Extracting `owner/repo` from a git remote (HTTPS or SSH URL) for `gh` calls | Use `gh-cli-agentic` once you already have the `owner/repo` identifier | | Handling GitHub Enterprise host URLs alongside github.com | Use `git-fork-workflow` when the question is fork vs upstream identification | | Resolving the repo identifier to pass with `gh -R` to avoid remote-required errors | Use `git-cli-agentic` for raw `git remote -v` parsing if you need URL details | | Detecting which repo a script is running inside before issuing API calls | Use `git-coworker-check` to detect concurrent agents in the same checkout | Expert knowledge for detecting and extracting GitHub repository information from git remotes, including repository name, owner, and full identifiers. ## Core Expertise **Repository Identification** - Extract owner and repository name from git remotes - Parse GitHub URLs (HTTPS and SSH) - Handle GitHub Enterprise URLs - Format as `owner/repo` for CLI/API usage **URL Parsing** - Parse HTTPS URLs: `https://github.com/owner/repo.git` - Parse SSH URLs: `[email protected]:owner/repo.git` - Handle custom domains: `https://github.enterprise.com/owner/repo.git` - Clean `.git` suffix and extra paths ## Essential Commands ### Get Remote URLs ```bash # List all remotes git remote -v # Get origin URL git remote get-url origin # Get specific remote git remote get-url upstream # Show remote details git remote show origin ``` ### Extract Repository Name ```bash # From HTTPS URL git remote get-url origin | sed 's/.*\/\([^/]*\)\.git/\1/' # From SSH URL git remote get-url origin | sed 's/.*:\([^/]*\/[^/]*\)\.git/\1/' | cut -d'/' -f2 # From any URL (owner/repo format) git remote get-url origin | sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/' # Just repository name (no owner) basename $(git remote get-url origin) .git ``` ### Extract Owner ```bash # From any URL git remote get-url origin | sed 's/.*[:/]\([^/]*\)\/[^/]*\.git/\1/' # Alternative with awk git remote get-url origin | awk -F '[:/]' '{print $(NF-1)}' ``` ### Get Full Identifier (owner/repo) ```bash # Standard format for GitHub CLI/API git remote get-url origin | sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/' # With validation REPO=$(git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/') echo "${REPO:-Unknown}" # Store in variable REPO_FULL=$(git remote get-url origin | sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/') echo "Repository: $REPO_FULL" ``` ## URL Format Examples ### HTTPS URLs ```bash # Standard GitHub https://github.com/owner/repo.git # Extract: owner/repo # Without .git suffix https://github.com/owner/repo # Extract: owner/repo # GitHub Enterprise https://github.company.com/owner/repo.git # Extract: owner/repo ``` ### SSH URLs ```bash # Standard SSH [email protected]:owner/repo.git # Extract: owner/repo # Custom SSH port ssh://[email protected]:443/owner/repo.git # Extract: owner/repo # Enterprise SSH [email protected]:owner/repo.git # Extract: owner/repo ``` ## Parsing Patterns ### Universal Parser (HTTPS or SSH) ```bash # Works for both HTTPS and SSH parse_repo() { local url="$1" # Remove .git suffix url="${url%.git}" # Extract owner/repo if [[ "$url" =~ github\.com[:/]([^/]+/[^/]+) ]]; then echo "${BASH_REMATCH[1]}" elif [[ "$url" =~ :([^/]+/[^/]+)$ ]]; then echo "${BASH_REMATCH[1]}" fi } REPO=$(parse_repo "$(git remote get-url origin)") echo "$REPO" ``` ### Robust Extraction with sed ```bash # Handle both HTTPS and SSH, with or without .git git remote get-url origin \ | sed -E 's#.*github\.com[:/]##; s#\.git$##' ``` ### Using awk ```bash # Split by : or / and get last two components git remote get-url origin \ | awk -F'[/:]' '{print $(NF-1)"/"$NF}' \ | sed 's/\.git$//' ``` ## Real-World Usage ### With GitHub CLI ```bash # Get repo identifier for gh commands REPO=$(git remote get-url origin | sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/') # Use with gh gh repo view "$REPO" gh issue list --repo "$REPO" gh pr list --repo "$REPO" # Or use current directory (gh auto-detects) gh repo view ``` For API usage, multiple remotes, scripts, aliases, and integration examples, see [REFERENCE.md](REFERENCE.md). ## Edge Cases | Case | Check | |------|-------| | No remote | `git remote get-url origin &>/dev/null` | | Non-GitHub | `git remote get-url origin \| grep -q github.com` | | Multiple remotes | Use `git remote get-url upstream` for fork source | | Submodule | `git -C "$(git rev-parse --show-toplevel)" remote get-url origin` | ## Quick Reference | Purpose | Command | |---------|---------| | Full identifier (owner/repo) | `git remote get-url origin \| sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/'` | | Owner only | `git remote get-url origin \| sed 's/.*[:/]\([^/]*\)\/[^/]*\.git/\1/'` | | Name only | `basename $(git remote get-url origin) .git` | | Is GitHub? | `git remote get-url origin \| grep -q github.com` | | Validate in git repo | `git rev-parse --git-dir &>/dev/null` | | List remotes | `git remote -v` | | Set origin | `git remote set-url origin [email protected]:owner/repo.git` | ## Troubleshooting | Problem | Fix | |---------|-----| | Remote not found | `git remote add origin [email protected]:owner/repo.git` | | Wrong remote | `git remote set-url origin <correct-url>` | | Parse failure | Check raw URL: `git remote get-url origin` | ## Related Skills - **github MCP** - Use extracted repo name with GitHub API - **github-actions-inspection** - Pass repo to gh CLI commands - **git-workflow** - Identify repo for workflow operations
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.