Skip to content

Latest commit

 

History

History
125 lines (85 loc) · 4.37 KB

File metadata and controls

125 lines (85 loc) · 4.37 KB

name: github-push description: >- Push a local project to GitHub from Windows + China network environment. Use whenever the user mentions pushing, uploading, or putting code on GitHub — especially from Windows or behind GFW/proxy. compatibility: git >=2.40, ssh, clash-verge or v2ray environment: os: Windows 11 Home China 10.0.26100 shell: Git Bash (mingw64) network: "GFW-restricted — GitHub blocked, requires proxy at 127.0.0.1:7890" tools: git 2.47, ssh, Clash Verge

github-push

Push a local project to GitHub from Windows + China network environment

Environment

Key Value
OS Windows 11 Home China 10.0.26100
Shell Git Bash (mingw64)
Network GFW-restricted — GitHub blocked, requires proxy at 127.0.0.1:7890
Tools git 2.47, ssh, Clash Verge

Why this matters: GitHub is blocked by GFW; git push/pull time out without a proxy. HTTPS triggers Windows credential manager popups that break non-interactive use. Without this context, the agent will assume a standard Linux/macOS environment and fail with the same dead ends this skill documents.

When to use

This skill activates when the user asks to:

  • push to GitHub
  • upload this project to GitHub
  • create a GitHub repo for this
  • put this on GitHub
  • push my code to GitHub

The trigger phrases above cover how real users talk — from formal to casual. If a phrase feels unnatural, rewrite it to match how you actually speak.

Quick start

The most common use case distilled to the minimal path:

git config --global http.proxy http://127.0.0.1:7890 && git config --global https.proxy http://127.0.0.1:7890
git remote add origin git@github.com:USERNAME/REPO.git
git push -u origin main

Replace USERNAME/REPO with your actual repo. Ensure SSH key is added to GitHub first.

Proven approach

Steps verified in this environment. Every command below was actually run and succeeded.

1. Configure git proxy

git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890

Without proxy config, git push hangs or times out because GitHub is blocked by GFW. The proxy tunnels traffic through Clash Verge or v2ray.

2. Use SSH remote instead of HTTPS

git remote add origin git@github.com:USERNAME/REPO.git

HTTPS triggers Windows credential manager popups and often returns 403. SSH with key auth goes through the proxy cleanly. Ensure ~/.ssh/config has ProxyCommand configured for github.com.

3. Push with explicit branch name

git push -u origin main

Git Bash on Windows may misinterpret the default branch; explicit -u origin main avoids this. New repos default to 'main', not 'master'.

What this skill replaces

Before this skill existed, each session would independently:

  1. Try git push without proxy config → fail
  2. Try HTTPS remote + gh auth login → fail
  3. Eventually rediscover the winning path

Now the agent loads this skill and jumps straight to the proven approach. No rediscovery needed.

Pitfalls — what NOT to do

These were tried and failed in this environment. Each one cost real time.

Dead end Environment cause What happened
git push without proxy config GitHub is blocked by GFW at the network level Connection times out after 60s; 'fatal: unable to access'
HTTPS remote + gh auth login Browser OAuth flow blocked by proxy; Windows credential manager intercepts auth Endless popup loop or 403 forbidden even after 'successful' login
git push origin master New repos default branch is 'main', not 'master' 'src refspec master does not match any' — branch doesn't exist

Verification

Confirm success with:

git ls-remote --heads origin

Expected output: Lists remote branches without error, showing refs/heads/main

Notes

  • If proxy address differs (v2ray uses 10809, others may vary), update config accordingly
  • If SSH key not set up: ssh-keygen -t ed25519 -C "your@email.com" then add to GitHub Settings → SSH Keys
  • The connect tool for ProxyCommand comes with Git Bash; if missing, install mingw-w64-x86_64-connect via pacman

See also

  • GitHub docs: Connecting to GitHub with SSH
  • Clash Verge docs