load ssh-agent automatically for git private repos
In my cPanel user files, I'm using a private BitBucket repository.
In order to connect to it, I have created an SSH public/private key pair using the cPanel user interface so I can use them as a way to connect to my remote repository.
The problem is that I wasn't able to connect to the remote repo usng ssh keys, so after I googled a lot, I found that my ssh-agent is not loaded so I used:
Then it asks me the password for the private key and only after these I'm able to use my repository (push/pull..). And everytime I need to update my repo (ex. to pull the latest changes) I need to exececute those commands to start the ssh-agent and then to add the private key as an identity to it. How can I skip this manual start of ssh-agent .. or in the end I just wanna use my repo through ssh keys.
eval `ssh-agent -s`
ssh-add ~/.ssh/myCustomPrivateKeyThen it asks me the password for the private key and only after these I'm able to use my repository (push/pull..). And everytime I need to update my repo (ex. to pull the latest changes) I need to exececute those commands to start the ssh-agent and then to add the private key as an identity to it. How can I skip this manual start of ssh-agent .. or in the end I just wanna use my repo through ssh keys.
-
Thanks for the additional thoughts. I read through a few of the Bitbucket docs and they do use a key, so you'd need make the SSH connection happen with a key in some way. If you plan to use that user almost exclusively for the repo access, the automation I thought of might be the easiest way. 0 -
Yes, you're right.. I think that's the easiest way. Thank you. I appreciate your help :) 0 -
Sure thing! 0
Please sign in to leave a comment.
Comments
5 comments