$npx -y skills add adityahimaone/hermes-agent-rtk-caveman --skill github-repo-managementClone, create, fork, configure, and manage GitHub repositories. Manage remotes, secrets, releases, and workflows. Works with gh CLI or falls back to git + GitHub REST API via curl.
| 1 | # GitHub Repository Management |
| 2 | |
| 3 | Create, clone, fork, configure, and manage GitHub repositories. Each section shows `gh` first, then the `git` + `curl` fallback. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | - Authenticated with GitHub (see `github-auth` skill) |
| 8 | |
| 9 | ### Setup |
| 10 | |
| 11 | ```bash |
| 12 | if command -v gh &>/dev/null && gh auth status &>/dev/null; then |
| 13 | AUTH="gh" |
| 14 | else |
| 15 | AUTH="git" |
| 16 | if [ -z "$GITHUB_TOKEN" ]; then |
| 17 | if [ -f ~/.hermes/.env ] && grep -q "^GITHUB_TOKEN=" ~/.hermes/.env; then |
| 18 | GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" ~/.hermes/.env | head -1 | cut -d= -f2 | tr -d '\n\r') |
| 19 | elif grep -q "github.com" ~/.git-credentials 2>/dev/null; then |
| 20 | GITHUB_TOKEN=$(grep "github.com" ~/.git-credentials 2>/dev/null | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|') |
| 21 | fi |
| 22 | fi |
| 23 | fi |
| 24 | |
| 25 | # Get your GitHub username (needed for several operations) |
| 26 | if [ "$AUTH" = "gh" ]; then |
| 27 | GH_USER=$(gh api user --jq '.login') |
| 28 | else |
| 29 | GH_USER=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user | python3 -c "import sys,json; print(json.load(sys.stdin)['login'])") |
| 30 | fi |
| 31 | ``` |
| 32 | |
| 33 | If you're inside a repo already: |
| 34 | |
| 35 | ```bash |
| 36 | REMOTE_URL=$(git remote get-url origin) |
| 37 | OWNER_REPO=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/]||; s|\.git$||') |
| 38 | OWNER=$(echo "$OWNER_REPO" | cut -d/ -f1) |
| 39 | REPO=$(echo "$OWNER_REPO" | cut -d/ -f2) |
| 40 | ``` |
| 41 | |
| 42 | --- |
| 43 | |
| 44 | ## 1. Cloning Repositories |
| 45 | |
| 46 | Cloning is pure `git` — works identically either way: |
| 47 | |
| 48 | ```bash |
| 49 | # Clone via HTTPS (works with credential helper or token-embedded URL) |
| 50 | git clone https://github.com/owner/repo-name.git |
| 51 | |
| 52 | # Clone into a specific directory |
| 53 | git clone https://github.com/owner/repo-name.git ./my-local-dir |
| 54 | |
| 55 | # Shallow clone (faster for large repos) |
| 56 | git clone --depth 1 https://github.com/owner/repo-name.git |
| 57 | |
| 58 | # Clone a specific branch |
| 59 | git clone --branch develop https://github.com/owner/repo-name.git |
| 60 | |
| 61 | # Clone via SSH (if SSH is configured) |
| 62 | git clone git@github.com:owner/repo-name.git |
| 63 | ``` |
| 64 | |
| 65 | **With gh (shorthand):** |
| 66 | |
| 67 | ```bash |
| 68 | gh repo clone owner/repo-name |
| 69 | gh repo clone owner/repo-name -- --depth 1 |
| 70 | ``` |
| 71 | |
| 72 | ## 2. Creating Repositories |
| 73 | |
| 74 | **With gh:** |
| 75 | |
| 76 | ```bash |
| 77 | # Create a public repo and clone it |
| 78 | gh repo create my-new-project --public --clone |
| 79 | |
| 80 | # Private, with description and license |
| 81 | gh repo create my-new-project --private --description "A useful tool" --license MIT --clone |
| 82 | |
| 83 | # Under an organization |
| 84 | gh repo create my-org/my-new-project --public --clone |
| 85 | |
| 86 | # From existing local directory |
| 87 | cd /path/to/existing/project |
| 88 | gh repo create my-project --source . --public --push |
| 89 | ``` |
| 90 | |
| 91 | **With git + curl:** |
| 92 | |
| 93 | ```bash |
| 94 | # Create the remote repo via API |
| 95 | curl -s -X POST \ |
| 96 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 97 | https://api.github.com/user/repos \ |
| 98 | -d '{ |
| 99 | "name": "my-new-project", |
| 100 | "description": "A useful tool", |
| 101 | "private": false, |
| 102 | "auto_init": true, |
| 103 | "license_template": "mit" |
| 104 | }' |
| 105 | |
| 106 | # Clone it |
| 107 | git clone https://github.com/$GH_USER/my-new-project.git |
| 108 | cd my-new-project |
| 109 | |
| 110 | # -- OR -- push an existing local directory to the new repo |
| 111 | cd /path/to/existing/project |
| 112 | git init |
| 113 | git add . |
| 114 | git commit -m "Initial commit" |
| 115 | git remote add origin https://github.com/$GH_USER/my-new-project.git |
| 116 | git push -u origin main |
| 117 | ``` |
| 118 | |
| 119 | To create under an organization: |
| 120 | |
| 121 | ```bash |
| 122 | curl -s -X POST \ |
| 123 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 124 | https://api.github.com/orgs/my-org/repos \ |
| 125 | -d '{"name": "my-new-project", "private": false}' |
| 126 | ``` |
| 127 | |
| 128 | ### From a Template |
| 129 | |
| 130 | **With gh:** |
| 131 | |
| 132 | ```bash |
| 133 | gh repo create my-new-app --template owner/template-repo --public --clone |
| 134 | ``` |
| 135 | |
| 136 | **With curl:** |
| 137 | |
| 138 | ```bash |
| 139 | curl -s -X POST \ |
| 140 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 141 | https://api.github.com/repos/owner/template-repo/generate \ |
| 142 | -d '{"owner": "'"$GH_USER"'", "name": "my-new-app", "private": false}' |
| 143 | ``` |
| 144 | |
| 145 | ## 3. Forking Repositories |
| 146 | |
| 147 | **With gh:** |
| 148 | |
| 149 | ```bash |
| 150 | gh repo fork owner/repo-name --clone |
| 151 | ``` |
| 152 | |
| 153 | **With git + curl:** |
| 154 | |
| 155 | ```bash |
| 156 | # Create the fork via API |
| 157 | curl -s -X POST \ |
| 158 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 159 | https://api.github.com/repos/owner/repo-name/forks |
| 160 | |
| 161 | # Wait a moment for GitHub to create it, then clone |
| 162 | sleep 3 |
| 163 | git clone https://github.com/$GH_USER/repo-name.git |
| 164 | cd repo-name |
| 165 | |
| 166 | # Add the original repo as "upstream" remote |
| 167 | git remote add upstream https://github.com/owner/repo-name.git |
| 168 | ``` |
| 169 | |
| 170 | ### Keeping a Fork in Sync |
| 171 | |
| 172 | ```bash |
| 173 | # Pure git — works everywhere |
| 174 | git fetch upstream |
| 175 | git checkout main |
| 176 | git merge upstream/main |
| 177 | git push origin main |
| 178 | ``` |
| 179 | |
| 180 | **With gh (shortcut):** |
| 181 | |
| 182 | ```bash |
| 183 | gh repo sync $GH_USER/repo-name |
| 184 | ``` |
| 185 | |
| 186 | ## 4. Repository Information |
| 187 | |
| 188 | **With gh:** |
| 189 | |
| 190 | ```bash |
| 191 | gh repo view owner/repo-name |
| 192 | gh repo list --limit 20 |
| 193 | gh search repos "machine learning" --language |