4.2 KiB
4.2 KiB
Git Credentials Quick Start Guide
🚀 Quick Setup (Choose One Method)
Method 1: Git Credential Manager (Recommended for Windows)
# 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)
# 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
# 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
# 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
# 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
# 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)
# 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
-
Check credential helper:
git config --global credential.helper
-
Clear VS Code's Git cache:
- VS Code:
Ctrl+Shift+P
→ "Git: Clear Credentials"
- VS Code:
-
Reset Git configuration:
git config --global --unset credential.helper # Then run setup script again
SSH Connection Issues
# 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:
- Log into git.d-popov.com web interface
- Go to User Settings → Access Tokens
- Create new token with
read/write
permissions - Copy token (you won't see it again!)
Add SSH Key:
- Log into git.d-popov.com web interface
- Go to User Settings → SSH Keys
- Paste your public key (
id_ed25519.pub
) - 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?
- Run the test script:
.\test-git-credentials.ps1
- Check VS Code Git output panel for errors
- Verify your Git server configuration
- Try different authentication methods
Quick Fix: Run .\setup-git-credentials.ps1
and choose option 1 (GCM) - it usually solves most issues! 🎯