when you have a server that needs pull access to a single private repo. This key is attached directly to the repository instead of to a personal user account.
If you have a Jenkins user, you can store your deploy key in ~/.ssh/id_rsa. When Jenkins tries to clone the repo via ssh, it will try to use that key.
In some setups you cannot use the default ssh key location. In such cases you create a key in different location(~/.ssh/deploy_key) and configure ssh in ~/.ssh/config.
Host github-deploy-myproject
    HostName       github.com
    User           git
    IdentityFile   ~/.ssh/deploy_key
    IdentitiesOnly yes
we create a host alias github-deploy-myproject because you don’t want to use the above keys to all your github connections. Your clone URL now becomes
git clone github-deploy-myproject:myuser/myproject