Comprehensive guide to diagnosing and fixing common gitshift issues
- Quick Diagnostics
- Common Issues
- SSH Issues
- Git Configuration Issues
- Account Management Issues
- GitHub Integration Issues
- Zsh Secrets Issues
- Performance Issues
- Advanced Troubleshooting
- Getting Help
# Full system diagnostics
gitshift diagnose --verbose
# Auto-fix detected issues
gitshift diagnose --fix
# Focus on specific components
gitshift diagnose --ssh-only
gitshift diagnose --git-only
gitshift diagnose --accounts-only# Check system health
gitshift health
# Check current account status
gitshift status
# Validate current configuration
gitshift config validateProblem: gitshift: command not found
Solutions:
# 1. Check if binary exists
ls -la gitshift
# 2. Make binary executable
chmod +x gitshift
# 3. Install system-wide
sudo mv gitshift /usr/local/bin/
# 4. Add to PATH
export PATH="$PATH:/path/to/gitshift"
echo 'export PATH="$PATH:/path/to/gitshift"' >> ~/.zshrcProblem: Permission denied when running gitshift
Solutions:
# 1. Check file permissions
ls -la gitshift
# 2. Fix permissions
chmod +x gitshift
# 3. Check directory permissions
ls -la /usr/local/bin/gitshiftProblem: Configuration file not found
Solutions:
# 1. Check config directory
ls -la ~/.config/gitshift/
# 2. Create config directory
mkdir -p ~/.config/gitshift
# 3. Initialize configuration
gitshift diagnose --fix
# 4. Set custom config path
export gitshift_CONFIG_PATH="/custom/path"Problem: Permission denied (publickey) when connecting to GitHub
# 1. Test SSH connection manually
ssh -T git@github.com
# 2. Test with specific key
ssh -T git@github.com -i ~/.ssh/id_ed25519_work
# 3. Check SSH agent
ssh-add -l
# 4. Diagnose with gitshift
gitshift diagnose --ssh-only --verbose# 1. Use gitshift's comprehensive SSH troubleshooting
gitshift ssh-troubleshoot --verbose
# 2. Auto-fix SSH issues
gitshift ssh-troubleshoot --auto-fix
# 3. Check SSH key permissions
ls -la ~/.ssh/id_ed25519_work
# Should be: -rw------- (600)
# 4. Fix permissions
chmod 600 ~/.ssh/id_ed25519_work
chmod 700 ~/.ssh
# 5. Add key to SSH agent
ssh-add ~/.ssh/id_ed25519_work
# 6. Test key with GitHub
ssh -T git@github.com -i ~/.ssh/id_ed25519_work
# 7. Verify key is added to GitHub account
# Go to GitHub Settings > SSH and GPG keysProblem: unix_listener: cannot bind to path /Users/username/.ssh/socket/...
# 1. Check socket directories
ls -la ~/.ssh/socket/
ls -la ~/.ssh/sockets/
ls -la ~/.ssh/control/
# 2. Check SSH agent status
gitshift ssh-agent --status# 1. Create missing directories
mkdir -p ~/.ssh/socket ~/.ssh/sockets ~/.ssh/control
# 2. Set correct permissions
chmod 700 ~/.ssh/socket ~/.ssh/sockets ~/.ssh/control
# 3. Let gitshift fix automatically
gitshift diagnose --fix
# 4. Restart SSH agent
gitshift ssh-agent --clear
gitshift ssh-agent --startProblem: Wrong account authenticating due to multiple keys
# 1. List loaded keys
ssh-add -l
# 2. Check SSH config
cat ~/.ssh/config
# 3. Diagnose with gitshift
gitshift diagnose --ssh-only --verbose# 1. Use gitshift's SSH troubleshooting for key conflicts
gitshift ssh-troubleshoot --verbose
# 2. Auto-fix SSH key conflicts
gitshift ssh-troubleshoot --auto-fix
# 3. Generate proper SSH configuration
gitshift ssh-config generate --apply
# 4. Clear all keys from agent
gitshift ssh-agent --clear
# 5. Load only the required key
gitshift ssh-agent --load ~/.ssh/id_ed25519_work
# 6. Use SSH config with IdentitiesOnly
echo "IdentitiesOnly yes" >> ~/.ssh/config
# 7. Test with specific key
ssh -T git@github.com -i ~/.ssh/id_ed25519_workProblem: Repository not found error when you have access to the repository
This is a common issue when multiple SSH keys are loaded in the SSH agent, causing GitHub to authenticate with the wrong key.
# 1. Use gitshift's comprehensive SSH diagnostics
gitshift ssh-troubleshoot --verbose
# 2. Check for SSH key conflicts
gitshift diagnose --ssh-only --verbose
# 3. List loaded SSH keys
ssh-add -l# 1. Auto-fix SSH key conflicts
gitshift ssh-troubleshoot --auto-fix
# 2. Generate proper SSH configuration
gitshift ssh-config generate --apply
# 3. Clean up SSH agent
gitshift ssh-agent --cleanup
# 4. Test GitHub connectivity
gitshift ssh-troubleshoot --test-githubProblem: No such file or directory for SSH key
# 1. Check if key file exists
ls -la ~/.ssh/id_ed25519_work
# 2. Check account configuration
gitshift config show --account work# 1. Generate new SSH key (automatically adds to ssh-agent and clipboard)
gitshift ssh-keygen work --email work@company.com
# 2. Update account configuration
gitshift config set --account work ssh_key_path "/new/path"
# 3. Use existing key
gitshift config set --account work ssh_key_path "/existing/path"Problem: Commits showing wrong name/email
# 1. Check current Git config
git config --global --list
git config --local --list
# 2. Check current account
gitshift status
# 3. Validate Git configuration
gitshift validate-git# 1. Switch to correct account
gitshift switch work
# 2. Manually set Git config
git config --global user.name "John Doe"
git config --global user.email "john@company.com"
# 3. Fix with gitshift
gitshift diagnose --git-only --fixProblem: Git not using correct SSH key
# 1. Check SSH command
git config --global core.sshCommand
# 2. Check account configuration
gitshift config show --account work# 1. Set SSH command manually
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519_work -o IdentitiesOnly=yes"
# 2. Switch account (auto-sets SSH command)
gitshift switch work
# 3. Fix with gitshift
gitshift diagnose --git-only --fixProblem: Local and global Git config conflicts
# 1. Check config precedence
git config --list --show-origin
# 2. Check for local config
ls -la .git/config# 1. Remove conflicting local config
git config --local --unset user.name
git config --local --unset user.email
# 2. Use global config only
gitshift config set global_git_config true
# 3. Set up project-specific config
gitshift project set workProblem: Account 'work' not found
# 1. List all accounts
gitshift list
# 2. Check configuration
gitshift config show
# 3. Validate configuration
gitshift config validate# 1. Add missing account
gitshift add-github username --alias work
# 2. Check account alias
gitshift list --account work
# 3. Fix account configuration
gitshift config validate --fixProblem: Account switch fails with validation errors
# 1. Force switch with verbose output
gitshift switch work --force --verbose
# 2. Check account validation
gitshift diagnose --accounts-only
# 3. Check SSH validation
gitshift diagnose --ssh-only# 1. Fix account configuration
gitshift diagnose --fix
# 2. Reset SSH agent
gitshift ssh-agent --clear
# 3. Skip validation (temporary)
gitshift switch work --skip-validation
# 4. Force switch
gitshift switch work --forceProblem: Multiple accounts with same alias
# 1. List all accounts
gitshift list
# 2. Check configuration file
cat ~/.config/gitshift/config.yaml# 1. Remove duplicate account
gitshift remove duplicate-alias
# 2. Rename account
gitshift config set --account old-alias alias new-alias
# 3. Fix configuration manually
gitshift config editProblem: GitHub CLI (gh) is not installed
# 1. Install GitHub CLI
# macOS
brew install gh
# Ubuntu/Debian
sudo apt install gh
# Windows
winget install GitHub.cli
# 2. Verify installation
gh --version
# 3. Authenticate
gh auth loginProblem: GitHub authentication failed
# 1. Check GitHub CLI status
gh auth status
# 2. Test GitHub API
gh api user
# 3. Check token
gh auth token# 1. Re-authenticate
gh auth login
# 2. Logout and login again
gh auth logout
gh auth login
# 3. Check network connectivity
curl -I https://api.github.comProblem: API rate limit exceeded
# 1. Check rate limit
gh api rate_limit
# 2. Wait and retry
sleep 60
gitshift switch work
# 3. Use personal access token
export GITHUB_TOKEN="ghp_your_token"Problem: zsh_secrets file not found
# 1. Check common locations
ls -la ~/.zsh_secrets
ls -la ~/.config/zsh_secrets
ls -la ~/.secrets/zsh_secrets
ls -la ~/.zsh/secrets
# 2. Check gitshift logs
tail -f ~/.config/gitshift/logs/gitshift.log# 1. Create zsh_secrets file
touch ~/.zsh_secrets
chmod 600 ~/.zsh_secrets
# 2. Let gitshift create it
gitshift switch work
# 3. Set custom location
export gitshift_ZSH_SECRETS_PATH="/custom/path"Problem: Token not updating in zsh_secrets file
# 1. Check current token
gh auth token
# 2. Check zsh_secrets content
cat ~/.zsh_secrets
# 3. Test token update
gitshift secrets update-token# 1. Update token manually
gitshift secrets update-token
# 2. Check file permissions
ls -la ~/.zsh_secrets
chmod 600 ~/.zsh_secrets
# 3. Validate zsh_secrets file
gitshift secrets validate
# 4. Reload zsh_secrets
gitshift secrets reloadProblem: Invalid syntax in zsh_secrets file
# 1. Check file syntax
bash -n ~/.zsh_secrets
# 2. Validate with gitshift
gitshift secrets validate
# 3. Check file content
cat ~/.zsh_secrets# 1. Backup corrupted file
cp ~/.zsh_secrets ~/.zsh_secrets.backup
# 2. Fix syntax errors
gitshift secrets validate --fix
# 3. Restore from backup
gitshift secrets restore --backup 1
# 4. Recreate file
rm ~/.zsh_secrets
gitshift switch workProblem: Account switch takes too long
# 1. Enable debug logging
export gitshift_DEBUG=true
# 2. Run with verbose output
gitshift switch work --verbose
# 3. Check system resources
top
df -h# 1. Skip SSH validation for speed
gitshift switch work --skip-validation
# 2. Clear SSH agent cache
gitshift ssh-agent --clear
# 3. Optimize SSH configuration
gitshift ssh-config optimize
# 4. Check disk space
df -hProblem: gitshift using too much memory
# 1. Check memory usage
ps aux | grep gitshift
# 2. Restart gitshift
pkill gitshift
# 3. Clear caches
gitshift cache clear
# 4. Optimize configuration
gitshift config optimize# 1. Set debug environment variable
export gitshift_DEBUG=true
# 2. Set log level
export gitshift_LOG_LEVEL=debug
# 3. Run command with verbose output
gitshift switch work --verbose
# 4. Check logs
tail -f ~/.config/gitshift/logs/gitshift.log# 1. Collect system information
gitshift diagnose --include-system > debug-info.txt
# 2. Include in bug reports
cat debug-info.txt# 1. Backup current configuration
gitshift config backup
# 2. Reset to defaults
gitshift config reset
# 3. Restore from backup if needed
gitshift config restore --backup 1# 1. Remove configuration
rm -rf ~/.config/gitshift
# 2. Remove SSH keys (optional)
rm -rf ~/.ssh/id_ed25519_*
# 3. Reinstall gitshift
go build -o gitshift
sudo mv gitshift /usr/local/bin/
# 4. Reconfigure
gitshift add-github username# 1. Set proxy environment variables
export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=http://proxy.company.com:8080
# 2. Configure Git with proxy
git config --global http.proxy http://proxy.company.com:8080
git config --global https.proxy http://proxy.company.com:8080
# 3. Configure SSH with proxy
# Add to ~/.ssh/config:
# Host github.com
# ProxyCommand nc -X connect -x proxy.company.com:8080 %h %p# 1. Test GitHub connectivity
curl -I https://api.github.com
# 2. Test SSH connectivity
ssh -T git@github.com
# 3. Check firewall rules
sudo ufw status# General help
gitshift --help
# Command-specific help
gitshift diagnose --help
gitshift switch --help
gitshift ssh-keys --help# Comprehensive diagnostics
gitshift diagnose --verbose
# System information
gitshift diagnose --include-system
# Health check
gitshift health- Report Bugs - Report issues and bugs
- Feature Requests - Request new features
**Bug Description**
Brief description of the issue
**Steps to Reproduce**
1. Run command: `gitshift switch work`
2. See error: `Permission denied (publickey)`
**Expected Behavior**
Account should switch successfully
**Actual Behavior**
Switch fails with SSH authentication error
**Environment**
- OS: macOS 14.0
- gitshift Version: 1.0.0
- Go Version: 1.21.0
**Debug Information**$ gitshift diagnose --include-system [Output here]
**Additional Context**
Any other relevant information
For enterprise users requiring professional support:
- Email: support@gitshift.com
- SLA: 24-hour response time
- Implementation: Help with gitshift deployment
- Customization: Tailored configurations
- Training: Team training sessions
- User Guide - Complete user documentation
- Configuration Guide - Detailed configuration options
- Architecture Guide - Technical architecture details
- Security Guide - Security best practices
- Contributing Guide - How to contribute
Still need help?