Gitlab CI – SSH Into Virtual Private Server (VPS) Using Private Key From Gitlab CI Pipeline Job1 min read
- In Programming
Gitlab CI is a pain in the ass sometimes. It was a pain in my ass too.
I was stuck for more than 2 hours trying to figure out how to SSH into my own server with my own private key.
I tried so many things. And the shit becomes even more frustrating when the same piece of code works on your local but not on Gitlab CI.
In my case, it went a step further to test my sanity. I used the local docker alpine image which I was using in Gitlab CI, and it worked. But the same image with same commands didn’t work on Gitlab.
I know I felt like pulling my hairs off. But finally, with a few adjustments, I found in various places. I was able to piece it all together.
Here’s the code snippet that I’m not letting go for many years to come 😀
Please let me know if you are facing any trouble. I might point you in the right direction. And do not forget to subscribe 🙂
Just stay back and explore more in Programming.