5.1 KiB
5.1 KiB
Git Credentials Quick Start Guide (Linux Mint)
🚀 Quick Setup (Choose One Method)
Method 1: SSH Keys (Most Secure - Recommended)
# Run the setup script
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-git-credentials-linux.sh
# Choose option 1 (SSH Keys)
What it does:
- Generates SSH key pair automatically
- Shows public key to add to git.d-popov.com
- Changes remote URL to SSH for passwordless access
- Tests SSH connection
Method 2: GNOME Keyring (Encrypted Storage)
# Run the setup script
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-git-credentials-linux.sh
# Choose option 4 (GNOME Keyring)
What it does:
- Installs git-credential-libsecret
- Configures Git to use GNOME Keyring
- Stores credentials encrypted in system keyring
- Works with Seahorse (Passwords and Keys)
Method 3: Personal Access Token
# Run the setup script
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-git-credentials-linux.sh
# Choose option 5 (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-linux.sh
This will:
- ✅ Check your credential configuration
- ✅ Test Git operations
- ✅ Verify SSH keys (if using SSH)
- ✅ Provide troubleshooting tips
🔧 Manual Commands (If Needed)
SSH Key Setup (Manual)
# Generate SSH key
ssh-keygen -t ed25519 -C "your-email@example.com"
# Start SSH agent (if not running)
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Copy public key to clipboard
xclip -sel clip < ~/.ssh/id_ed25519.pub
# Test SSH connection
ssh -T git@git.d-popov.com
Change Remote URL
# Check current remote
git remote -v
# Change to SSH (recommended)
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
GNOME Keyring Setup (Manual)
# Install dependencies
sudo apt update
sudo apt install -y libsecret-1-0 libsecret-1-dev
# Build and install git-credential-libsecret
cd /tmp
git clone https://github.com/git-ecosystem/git-credential-libsecret.git
cd git-credential-libsecret
sudo make install
# Configure Git
git config --global credential.helper libsecret
🚨 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 (
~/.ssh/id_ed25519.pub
) - Save and test:
ssh -T git@git.d-popov.com
🔐 Security Best Practices
- ✅ SSH Keys: Most secure, no passwords stored
- ✅ GNOME Keyring: Encrypted storage, system integration
- ⚠️ Store Credentials: Plain text (avoid on shared computers)
- ✅ Personal Access Tokens: Time-limited, can be revoked
- ✅ Regular Rotation: Change tokens/keys periodically
Linux Mint Specific Features
Seahorse (Passwords and Keys)
# Install Seahorse
sudo apt install -y seahorse
# Launch from menu or command:
seahorse
# View/manage Git credentials stored in GNOME Keyring
SSH Agent Integration
# Check if SSH agent is running
ps aux | grep ssh-agent
# Start SSH agent automatically (add to ~/.bashrc)
if [ -z "$SSH_AGENT_PID" ]; then
eval "$(ssh-agent -s)"
fi
# Add SSH key to agent
ssh-add ~/.ssh/id_ed25519
Git Configuration for Linux
# View all Git config
git config --list --show-origin
# Set up credential cache (15 minutes)
git config --global credential.helper cache
# Custom cache timeout (1 hour)
git config --global credential.helper 'cache --timeout=3600'
📞 Need Help?
- Run the test script:
./test-git-credentials-linux.sh
- Check VS Code Git output panel for errors
- Verify your Git server configuration
- Try different authentication methods
Quick Fix: Run ./setup-git-credentials-linux.sh
and choose option 1 (SSH Keys) - it usually solves most issues! 🎯