# Git Credentials Quick Start Guide ## ๐Ÿš€ Quick Setup (Choose One Method) ### Method 1: Git Credential Manager (Recommended for Windows) ```powershell # Run the setup script cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner .\setup-git-credentials.ps1 # Choose option 1 (Git Credential Manager) ``` **What it does:** - Installs Microsoft's Git Credential Manager - Configures Git to use it - Opens browser for authentication - Securely stores credentials ### Method 2: SSH Keys (Most Secure) ```powershell # Run the setup script cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner .\setup-git-credentials.ps1 # Choose option 3 (SSH Keys) ``` **What it does:** - Generates SSH key pair - Shows public key to add to git.d-popov.com - Changes remote URL to SSH - Enables passwordless authentication ### Method 3: Personal Access Token ```powershell # Run the setup script cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner .\setup-git-credentials.ps1 # Choose option 4 (Personal Access Token) ``` **What it does:** - Configures Git to store credentials - Next push/pull will prompt for token - Remembers credentials for future use ## ๐Ÿงช Test Your Setup ```powershell # Test script cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner .\test-git-credentials.ps1 ``` This will: - โœ… Check your credential configuration - โœ… Test Git operations - โœ… Provide troubleshooting tips - โœ… Show SSH key status (if using SSH) ## ๐Ÿ”ง Manual Commands (If Needed) ### Clear Stored Credentials ```bash # Clear all stored credentials git config --global --unset credential.helper git config --global credential.helper store # Reset to basic store # Or clear specific credentials git config --global --unset-all credential.helper ``` ### Change Remote URL ```bash # Check current remote git remote -v # Change to SSH (if you have SSH keys) git remote set-url origin git@git.d-popov.com:popov/mines.git # Change back to HTTPS git remote set-url origin https://git.d-popov.com/popov/mines.git ``` ### SSH Key Setup (Manual) ```bash # Generate SSH key ssh-keygen -t ed25519 -C "your-email@example.com" # Start SSH agent eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 # Copy public key to clipboard (Windows) type %USERPROFILE%\.ssh\id_ed25519.pub | clip # Test SSH connection ssh -T git@git.d-popov.com ``` ## ๐Ÿšจ Troubleshooting ### VS Code Still Asks for Credentials 1. **Check credential helper:** ```bash git config --global credential.helper ``` 2. **Clear VS Code's Git cache:** - VS Code: `Ctrl+Shift+P` โ†’ "Git: Clear Credentials" 3. **Reset Git configuration:** ```bash git config --global --unset credential.helper # Then run setup script again ``` ### SSH Connection Issues ```bash # Test SSH connection ssh -T git@git.d-popov.com # Debug SSH ssh -v git@git.d-popov.com # Check SSH agent ssh-add -l ``` ### Permission Denied - โœ… Check if SSH key is added to git.d-popov.com - โœ… Verify SSH key has correct permissions (600) - โœ… Make sure you're using the correct username ### Authentication Failed - โœ… Verify Personal Access Token hasn't expired - โœ… Check if token has correct permissions - โœ… Try regenerating the token ## ๐Ÿ“‹ For git.d-popov.com Server ### Generate Personal Access Token: 1. Log into git.d-popov.com web interface 2. Go to User Settings โ†’ Access Tokens 3. Create new token with `read/write` permissions 4. Copy token (you won't see it again!) ### Add SSH Key: 1. Log into git.d-popov.com web interface 2. Go to User Settings โ†’ SSH Keys 3. Paste your public key (`id_ed25519.pub`) 4. Save and test: `ssh -T git@git.d-popov.com` ## ๐Ÿ” Security Best Practices - โœ… **SSH Keys**: Most secure, no passwords stored - โœ… **Git Credential Manager**: Secure storage with encryption - โš ๏ธ **Store Credentials**: Plain text (avoid on shared computers) - โœ… **Personal Access Tokens**: Time-limited, can be revoked - โœ… **Regular Rotation**: Change tokens/keys periodically ## ๐Ÿ“ž Need Help? 1. Run the test script: `.\test-git-credentials.ps1` 2. Check VS Code Git output panel for errors 3. Verify your Git server configuration 4. Try different authentication methods **Quick Fix:** Run `.\setup-git-credentials.ps1` and choose option 1 (GCM) - it usually solves most issues! ๐ŸŽฏ