| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
The git-switcher repository contains simple, no-external dependency (except for Git) Windows batch scripts that offer easy switching between different Git global user account identities, resetting the Git user's password for GitHub, GitLab, or BitBucket using two (2) options:
After a successful Git global account switch and password reset using main.bat, subsequent Git pull/push/fetch will prompt for the Git user password or Personal Access Token (PAT).
Tip
Subsequent Git pull/push/fetch will NOT prompt for the Git user password or Personal Access Token (PAT) if this token is provided in the .env file when using the main-wincred.bat script.
main-wincred.bat
KLEOPATRA Kleopatra v3.2.2.231170 (Gpg4win-4.3.1) KDE Frameworks v5.109.0 Qt v5.15.9 (built against 5.15.9) GPG (Installed with Kleopatra) gpg (GnuPG) 2.4.5 libgcrypt 1.10.3
Windows batch script to automate git user (view, edit, and reset password) commands from a ~/.gitcredential file.
This script only sets the global git user name and email.
Follow the instructions for setting up Git Bash for usage with this script at GitBash Configuration with main.bat .
WARNING: This script stores a Git user's password or Personal Access Token (PAT) in a ~/.gitcredential plain-text file, which may be unsafe. Consider using the main-wincred.bat script to ensure stricter Git account security using the Windows Credential Manager.
Windows batch script to automate git user (view, edit, and reset password) commands from the Windows Credential Manager.
Aside from setting the global git user name and email, this script also has options for setting the global git GPG signing key and automatically setting the Git user's Personal Access Token (PAT) in the Windows Credential Manager from the .env file.
Follow the instructions for setting up Git Bash for usage with this script at GitBash Configuration with main-wincred.bat.
INFO This script requires Git user account information in a .env file. Check out the required and optional keys and structure format of the .env file in the Installation section.
Clone this repository.
git clone https://github.com/weaponsforge/git-switcher.git
Select a Windows batch script to use: main.bat or main-wincred.bat.
Create a .env file following the pipe-delimited content format of the .env.example file to use with the main-wincred.bat. Replace its variables with actual values corresponding to Git accounts that you have access to. Create entries per line as many as needed.
| Key | Description |
|---|---|
| GIT_PROVIDER | Online Git provider. Currently, supported providers or platforms are GitHub, GitLab, and BitBucket. Accepted values are github (for GitHub), gitlab (for GitLab), and bitbucket (for BitBucket). |
| GIT_USERNAME | Git user name associated with the GIT_PROVIDER |
| GIT_EMAIL | User email associated with the GIT_USERNAME |
| GPG_KEY | (Optional) GPG key linked with the Git account for signing commits. If no GPG keys are set but there's a Personal Access Token (PAT), set its value to a hyphen "-". INFO: This option requires a GPG key linked and set-up with the Git account using the Gpg4win software. |
| PERSONAL_ACCESS_TOKEN | (Optional) Git account's Personal Access Token (PAT)The main-wincred.bat script will set the generic target and password in the Windows Credential Manager if this value is provided. Succeeding Git pull/push/fetch will no longer prompt for the Git user password or Personal Access Token (PAT). |
Example .env file:
github|myaccount|hello@gmail.com|12345|86473212 github|mysecond|second@gmail.com|45678 gitlab|worldtest gitlab|tester|testing@gmail.com|-|22222222 bitbucket|myother|other@gmail.com
Read the Usage section for reference on using the scripts after setting up GitBash from step # 2.
Configure your GitBash first with the following settings before using the script.
Warning
These settings remove the Windows Credential Manager process handling for Git to a text-based ".gitcredentials" file from an easy-to-access location. Proceed at your discretion.
[credential]
helper = manager
INFO: main-wincred.bat requires Git user accounts data set in a .env file.
Click to run the windows batch script file main-wincred.bat or main.bat. You may need to run it as an Administrator if there will be privilege errors.
20191026
| Back | FazBrowse Home | New Git URL |