As I explained in my previous article, we have migrated our code base to Git. In the process of automating the deployment process on our production server, I wanted to use one of the latest feature of BitBucket: deployment keys.
Bitbucket has a very well documented process describing the overall procedure, but the whole step about starting the ssh-agent and loading keys is something that is a bit cumbersome to reproduce every time one logs in to the production server to pull an update.
To simplify this a little bit, I have automated some of the steps so that:
- The ssh-agent is started every time the user logs in through SSH
- a simple script responsible of loading the key(s) can be executed when one want to load them