TFLH/gitout.bat
2026-08-12 10:35:10 +08:00

24 lines
605 B
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
echo 正在清除已保存的 Git 凭据...
echo.
rem 删除所有以 git: 开头的凭据(适用于 HTTPS)
for /f "tokens=*" %%i in ('cmdkey /list ^| findstr /i "git:"') do (
set "line=%%i"
echo 删除凭据: !line!
cmdkey /delete "!line!" >nul 2>&1
)
rem 使用 git 的 credential manager 清除(若安装了 Git Credential Manager Core)
echo.
echo 清除 Git Credential Manager 缓存...
git credential-manager-core erase < nul
echo.
echo ✅ Git 凭据已清除完成。
echo 请重新在 VS2022 中克隆或推送代码,系统将重新提示登录。
echo.
pause