Newbie: How to use deploy keys


ive just stated using github paid (private) version where im developing a webapp. I want to be able to deploy the webapp to my clients on a cpanel hosting account to get them setup fast. either by ussing SSH or via PHP installer script i will right.

The problem i have is the repo is private and so if i login to my server as root or the cpanel user and run git clone or git pull i get a ‘Permission denied (publickey)’.

Ive read up on deploy key / access keys but have no idea how i set these up. I would prefer to have the server globally be allowed to clone/pull repos from my private account no matter which website/domain im installing the new app to.

any help on this would be great…


There are a couple requirements that I see in your description:

  1. You want the server to be able to clone or pull from  any repository in your account
  2. Your repositories are private, so it seems like you don’t want just anyone with access to the server to be able to  push or change code in your repositories

Deploy keys are designed for access to a single repository, so you would have to use a separate key for each repository you wanted access to. Normal SSH keys grant both read and write access to your entire account, so that isn’t a good fit either.

What you could use is a machine user. Once you create the machine user account, you would add an SSH key to its account and use that SSH key on your server. You could grant it access to all repositories in your account, but if you are using a personal (not an organization) account, it would still have read/write access to your repositories. Organizations can grant read-only access to outside collaborators and it could then be used to clone all repositories in your organization but not push to them.

I hope that helps! Let us know if you have more questions.

Thank you for your response. I will do some more reading.

Im basically a web developer and want to be able to install my custom CMS system to new cpanel/hosting account on my server quickly rather than uploas the CMS everytime. i just want to be able to run GIT PULL from the SSH but because my github account is private it fails because its not authorizes.

what method would be best for my situation.


Both deploy keys and a machine user would function as a solution. As I mentioned in my previous post, they each have benefits and drawbacks. As for which will work best for you based on those benefits and drawbacks, that’s something that you’ll have to decide for yourself.