.claude/skills/git-pre-push-hook-ssh-timeout/SKILL.md
Debug "Connection to github.com closed by remote host" errors during git push. Use when: (1) Push fails with SSH connection closed error, (2) Pre-push hooks run slow API calls (Codex, OpenAI, external services), (3) Push works with --no-verify but fails normally. The SSH connection times out (~60s) while hooks run synchronously. Fix by removing redundant hooks (if CI covers it), making hooks async, or adding timeouts.
npx skillsauth add Dbochman/dotfiles git-pre-push-hook-ssh-timeoutInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Pre-push hooks that make slow API calls (like AI code review) cause GitHub's SSH connection to timeout and close, resulting in a misleading error message.
git push fails with: Connection to github.com closed by remote hostgit push --no-verifyIf CI/CD already runs the same check, the pre-push hook is redundant:
rm .husky/pre-push # or trash .husky/pre-push
Kill the slow operation if it exceeds a threshold:
# In pre-push hook
timeout 30s codex review --base main || echo "Review timed out, proceeding"
Run the check in background and don't block the push:
# In pre-push hook
(codex review --base main > /tmp/review.log 2>&1 &)
echo "Review running in background..."
exit 0
Already present in most setups - document it for users:
SKIP_CODEX_REVIEW=1 git push
# or
git push --no-verify
GitHub's SSH server has an idle connection timeout (~60 seconds). When a pre-push hook runs a synchronous API call that takes longer, the SSH connection sits idle waiting for the hook to complete. GitHub eventually closes the connection.
The error message doesn't indicate the hook is the problem - it looks like a network/SSH issue.
After fixing:
git push should complete without --no-verifyBefore (problematic):
# .husky/pre-push
codex review --base main # Takes 60+ seconds, times out SSH
After (fixed - rely on CI):
# .github/workflows/codex-review.yml already runs on PRs
# Just remove the hook entirely
development
Search the web for current information, news, facts, and answers. Use when asked questions about current events, needing to look something up, finding websites, researching topics, or when you need up-to-date information beyond your training data.
development
Summarize any URL, YouTube video, podcast, PDF, or file into concise text. Use when asked to read an article, summarize a link, get the gist of a video or podcast, extract content from a URL, or when you need to understand what a web page or document contains.
development
Play music via Spotify and control Google Home speakers. Use when asked to play music, songs, artists, playlists, podcasts, or control speakers/volume/audio.
testing
Create new OpenClaw skills, modify and improve existing skills, and measure skill performance with evals. Use when users want to create a skill from scratch, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. Also use when asked to "make a skill", "turn this into a skill", "improve this skill", or "test this skill".