How to use Deployment keys

In general Deployment keys is used to give a read only access to your git repository, which I think its the best options which you should use on your Production Server, at the end you don’t need to change anything on your production server, nor you want any changes to reflect or appear on your master branch.

Creating SSH key on Production Server:

You will have to create SSH key for your server which you will use to give access to your repository.

after you finish generating the key you will find it the Private and the Public keys with in the ~/.ssh directory.

we need to copy the content of the Public key to use it on our git hosting provider.

Adding Development Key to your git hosting provider:

1- BitBucket:

You will need to go to the Settings tab of your repository and click on Deployment Keys and add the content of your server Public key to it

2- GitHub:

As in bitbucket you will need to go to the Settings tab and click on Deploy keys and then add the content of your server Public key.

PS: you need to notice that github gives you the ability to give write access to this key, which I don’t encourage you to do, unless you have some important reasons to do so.

Filed under: Code, Linux

No comment yet, add your voice below!


Leave a Reply