1
This commit is contained in:
parent
a20a4e0649
commit
e6c51e1756
19
gitout.bat
19
gitout.bat
@ -1,23 +1,6 @@
|
||||
@echo off
|
||||
echo 正在清除已保存的 Git 凭据...
|
||||
echo.
|
||||
Set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\;C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin
|
||||
|
||||
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 中克隆或推送代码,系统将重新提示登录。
|
||||
printf "protocol=https\nhost=gitee.com\n\n" | git credential-manager erase
|
||||
echo.
|
||||
pause
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user