How to Logout from Git in windows | Git logout in windows
How to Logout and Re-Setup Git Credentials on Windows (Command Line Guide)
If you're switching Git accounts or need to reset your credentials on Windows, follow these step-by-step instructions to logout and reconfigure Git:
β Step 1: Clear Existing Git Credentials
-
Open Command Prompt or PowerShell
-
Clear cached credentials (if any):
-
If you're using Git Credential Manager (default in Git for Windows), run:
-
Alternatively, manually remove credentials via Windows Credential Manager:
-
Open the Start menu and search for "Credential Manager".
-
Go to the "Windows Credentials" tab.
-
Look for entries like
https://github.com
and remove them.
-
π€ Step 2: Reconfigure Git Global Username & Email
Set your Git identity globally using the following commands:
π Step 3: Reauthenticate with the Remote Repository
When you next interact with a remote (clone, pull, or push), Git will prompt you to log in again.
For example:
π Important: GitHub no longer supports password authentication via HTTPS. Use a Personal Access Token (PAT) instead of your password when prompted.
β Step 4: Verify Git Configuration
Run the following to verify your setup:
You should see your correct username, email, and credential helper listed.
π Step 5: Clone the Repository Again
Example:
Git will prompt you to log in via GitHub. Choose your preferred method (browser login, token, etc.) to authenticate.
π Thatβs it!
Youβve now successfully logged out and reset your Git credentials on Windows. Next time you push or pull, Git will use the new authentication.