Skip to content
Back to skills

Github Windows Auth

ASecurity

Diagnose and fix GitHub authentication issues on Windows when pushing fails with "Repository not found" or wrong-account errors. Use when git push fails despite the repo existing, when multiple GitHub accounts are in play (personal + org), or when Windows Credential Manager has stale credentials. Trigger on phrases like "push failed", "repository not found", "wrong account", "gh auth", "credential", "git push 403", or any push error after a gh auth login.

  • 4 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 12, 2026
securitygoshellgit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add aibot88/sec_skill_store --skill github-windows-auth --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Github Windows Auth?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Github Windows Auth
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aibot88-github-windows-auth/badge)](https://www.skillsdirectory.com/skills/aibot88-github-windows-auth)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: github-windows-auth
description: Diagnose and fix GitHub authentication issues on Windows when pushing fails with "Repository not found" or wrong-account errors. Use when git push fails despite the repo existing, when multiple GitHub accounts are in play (personal + org), or when Windows Credential Manager has stale credentials. Trigger on phrases like "push failed", "repository not found", "wrong account", "gh auth", "credential", "git push 403", or any push error after a gh auth login.
categories: [git, github, windows]
metadata:
  source: custom
  scope: global
---

# GitHub Windows Auth — Diagnose & Fix

Fix `git push` failures on Windows caused by stale credentials or mismatched GitHub accounts.

## The pattern

On Windows, git uses the **Windows Credential Manager** as its credential store. When multiple GitHub accounts are in use (e.g. personal `bmaltais` and org `bernardmaltais`), the stored credential can belong to the wrong account — and `gh auth switch` alone doesn't fix it because git bypasses `gh` and reads the cached token directly.

The fix is always the same three steps:
1. Clear the stale Windows credential
2. Tell git to use `gh` as its credential helper going forward
3. Push

## Diagnostic process

### Step 1 — Identify which account the remote needs

```powershell
git -C <repo-path> remote get-url origin
```

The org/user in the URL tells you which `gh` account must be active.

### Step 2 — Check which accounts `gh` knows about

```powershell
gh auth status
```

Look for the account matching the remote. If it's not listed, authenticate it first:

```powershell
gh auth login
```

### Step 3 — Switch `gh` active account if needed

```powershell
gh auth switch --user <username>
```

### Step 4 — Clear stale Windows credential and wire `gh` as helper

```powershell
cmdkey /delete:LegacyGeneric:target=git:https://github.com
gh auth setup-git
```

### Step 5 — Push

```powershell
git -C <repo-path> push
```

## Notes

- `gh auth setup-git` writes `gh auth git-credential` as the credential helper in the global git config. It persists — you only need to run it once per machine (or after `cmdkey /delete` wipes the old entry).
- If you have **two org accounts** (e.g. `bmaltais` and `bernardmaltais`), the active `gh` account at push time determines which token git uses. Switch before pushing to the other org.
- If `gh` is not on `PATH` in the current shell, reload it first:
  ```powershell
  $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","User") + ";" + [System.Environment]::GetEnvironmentVariable("PATH","Machine")
  ```

## Quick reference — full fix in one line

```powershell
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","User") + ";" + [System.Environment]::GetEnvironmentVariable("PATH","Machine")
gh auth switch --user <username>
cmdkey /delete:LegacyGeneric:target=git:https://github.com
gh auth setup-git
git -C <repo-path> push
```

Files in this skill

  • SKILL.md2.9 KB
  • source.json1004 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.