This tool helps system administrators and developers safely manage multiple GitHub repository access keys on a single machine. Perfect for CI/CD pipelines, deployment servers, and development environments requiring specific repository access controls.
- Generates unique SSH keys for individual GitHub repositories
- Automatically configures SSH settings for repository separation
- Prevents key conflicts when accessing multiple repositories
- Enhances security through repository-specific access control
- Streamlines continuous integration and deployment workflows
-
Continuous Integration Servers
- Generate distinct deploy keys for each project
- Maintain separation of concerns between repositories
- Enable secure automated deployments
-
Development Servers
- Manage multiple repository access points
- Keep repository permissions isolated
- Simplify project-specific SSH configurations
-
Production Deployments
- Create dedicated deploy keys for production systems
- Implement principle of least privilege
- Maintain secure repository access controls
- Download the script to your user's home directory
- Make it executable:
chmod u+x generateDeployKey.sh
Basic syntax:
./generateDeployKey.sh REPO_OWNER_NAME REPO_NAME
Example:
./generateDeployKey.sh facebook react
- Creates repository-specific RSA keys
- Automatically updates SSH config with isolated configurations
- Generates clone URLs with correct SSH aliases
- Compatible with Linux and macOS systems
- Requires basic shell environment
- Use descriptive repository names for better key management
- Keep generated keys secure and backed up
- Regularly audit and rotate keys as needed
- Document which servers use which deploy keys
- Remove unused keys and configurations promptly
If you make a mistake during key generation:
- Locate the relevant section in ~/.ssh/config
- Remove the configuration block starting with "New Key Generated on..."
- Delete the corresponding public and private key files
- Re-run the script with correct parameters
- GitHub Deploy Keys
- SSH Key Management
- Continuous Integration
- Secure Repository Access
- DevOps Automation
- SSH Configuration
- Git Security Best Practices
original: https://gist.github.com/mehdi89/f1a003a3382ffeac4a249bcae13fcac6
this is just a fork, this is so useful