# Git In Containers

> Git repository access in containerized AI chat environments. Use when user requests git clone, repo fetching, or GitHub operations in web/mobile AI chat sessions.

- Skill: `majiayu000/git-in-containers` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/git-in-containers`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/git-in-containers/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/git-in-containers

---


# Git in Container Environments

**IMPORTANT**: This skill is for containerized AI chat environments (web, iOS, Android) only. Native development environments have direct git access and do not need these workarounds.

## The Problem

**git clone does not work** in containerized AI environments. The egress proxy blocks git protocol even for whitelisted domains (401 on CONNECT tunnel).

## Workaround: raw.githubusercontent.com

Fetch individual files via curl:

```bash
curl -sL https://raw.githubusercontent.com/OWNER/REPO/BRANCH/path/to/file.py
```

### Example: Fetch a Python script

```bash
curl -sL https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/src/anthropic/__init__.py
```

## Fetching Directory Structure

Use GitHub Tree API to get directory listings:

```bash
curl -sL https://api.github.com/repos/OWNER/REPO/git/trees/BRANCH?recursive=1
```

This returns JSON with all files and their paths. You can then fetch files individually.

### Example: Browse a repository

```bash
# Get the tree
curl -sL https://api.github.com/repos/oaustegard/claude-skills/git/trees/main?recursive=1 | \
  python3 -c "import json, sys; [print(f['path']) for f in json.load(sys.stdin)['tree']]"

# Fetch specific files
curl -sL https://raw.githubusercontent.com/oaustegard/claude-skills/main/README.md
```

## Network Requirements

Domain `raw.githubusercontent.com` must be in project network allowlist.

If curl fails with `host_not_allowed`:
1. Inform user: `raw.githubusercontent.com` needs to be added to project network settings
2. Settings change requires new conversation to take effect

## Do Not

- **Never** attempt `git clone` (wastes time, always fails)
- **Never** suggest workarounds requiring git protocol
- **Never** retry with different git flags or SSH URLs
- **Never** recommend git submodules, git archive, or other git-protocol operations

## Alternative: Use MCP GitHub Integration

If available, the MCP GitHub server provides programmatic access to repositories without network restrictions.

## When This Skill Does Not Apply

- **Native development environments**: Have direct git access via proxy, use standard git commands
- **Local environments**: git clone works normally
- **Environments with git protocol access**: Use native git tools

