Windows环境下Git推送GitHub遇ArgumentNullException错误求助
I’ve run into this exact issue before with Git for Windows, and you’re spot-on—it’s almost always tied to corrupted or misconfigured entries in the Windows Credential Manager. Let’s walk through the steps to fix this once and for all:
Step 1: Clear Existing GitHub/Git Credentials
The wonky credentials are almost certainly triggering that null path error. Here’s how to wipe them clean:
- Open Credential Manager on Windows: Search for it in the Start Menu, or navigate via Control Panel → User Accounts → Credential Manager.
- Switch to the Windows Credentials tab.
- Look for any entries linked to
github.com,git, or your repository URL. Delete all of these entries (check both "Generic Credentials" and "Windows Credentials" sections).
Step 2: Reconfigure Git’s Credential Helper
Next, we’ll reset how Git handles credentials to avoid the null path glitch:
- Open Git Bash and run this command (your 2.17.0 version works best with
wincred):
If you prefer a temporary credential cache (expires after 15 minutes by default), use this instead:git config --global credential.helper wincredgit config --global credential.helper cache
Step 3: Test the Push Again
Now try your push command once more:
git push https://<my_username>@github.com/<my_repo>.git #ISSUE-123
You’ll be prompted to enter your GitHub credentials—use a Personal Access Token instead of your password if you have 2FA enabled, since GitHub no longer accepts passwords for HTTPS pushes. After entering valid credentials, the push should finish without that annoying null path error popping up.
Extra Troubleshooting Tips
- Check for misconfigured Git settings: Run
git config --list --globaland look for anycredential.pathentries. If you see one with an empty value, delete it with:git config --global --unset credential.path - Double-check your local repo path: Even if you confirmed it’s correct, special characters (like spaces, non-ASCII characters, or symbols) can sometimes trigger unexpected null value errors in Git’s Windows implementation.
Original Problem Context
The error occurs during this workflow:
git commit --all -m"#ISSUE-123 Rename example dirs; added command-line handlers" 22 files changed, 501 insertions(+), 7 deletions(-) git push https://<my_username>@github.com/<my_repo>.git #ISSUE-123 fatal: ArgumentNullException encountered. Value cannot be null. Parameter name: path
While the push completes after re-entering credentials, the error lingers until the credential store is fixed.
内容的提问来源于stack exchange,提问作者user707779

