What is a Deployment Key?
A deployment key is a type of authentication key used to grant secure, read-only or read-write access to a repository, server, or service without requiring user credentials. It is commonly used in automation and deployment pipelines.
Common Uses of Deployment Keys
- Git Repositories (e.g., GitHub, GitLab, Bitbucket)
- Deployment keys allow servers to pull from private repositories without using a personal access token or SSH agent.
- Example: Deploying a website from a private GitHub repo to a production server.
- CI/CD Pipelines
- Used in continuous integration/deployment workflows to securely access resources.
- Cloud Services & Servers
- Some cloud platforms require deployment keys for accessing private assets or environments.
How Deployment Keys Work
- Typically an SSH key pair (public & private).
- The public key is added to the remote repository or service.
- The private key is stored securely on the deployment server.
Example: Adding a Deployment Key to GitHub
- Generate an SSH key:
ssh-keygen -t rsa -b 4096 -C "deployment-key" -f deploy_key
- Add the public key (
deploy_key.pub
) to GitHub under Settings → Deploy Keys.
- Use the private key (
deploy_key
) on your server to authenticate Git operations.