Clone a private repository in cPanel
To clone a private repository in cPanel we can do it only through SSH, using a public key, since it does not allow authentication through username:password in an HTTPS URL in its interface.
To clone a repository via SSH, we will need a public key generated on our server, for this, you can follow this guide:
https://www.factoriadigital.com/soporte/es/tutoriales-y-preguntas-frecuentes/article/generar-importar-clave-ssh-desde-cpanel-consolaOnce we have the public SSH key, we can add it to our GitHub account, Bitbucket or the version control system we are using, to provide access to our server to our repository.
Import SSH key in Bitbucket
We access the private repository in Bitbucket and on the left side menu, click on
"Settings":
Once inside, if we have the necessary permissions in the repository, we will see the menu section "Access keys", we access and click on "Add Key":
We will see the following form, where we must enter an identifying name for our key and the public key copied as it is in the box below:
After this, click on "Add key" and we will have the key imported for the repository in Bitbucket.
Import SSH key in GitHub
To import the SSH key in Github, you can consult the following documentation:
https://help.github.com/es/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-accountClone repository
Go to
"Git Version Control" and click on
"Create". A form will appear, where to enter the data of the private repository that we are going to clone, for it we will need the URL that usually gives us GitHub or Bitbucket in the buttons of
"Clone"
, inside the own repository or the same URL of the repository.
In this case, as we want to clone a directory via SSH, we will need the URL highlighted in the orange box:
We will copy that URL into the
"Clone URL" field and leave the rest as default. If we need it to be installed in another directory, we can change it in the
"Repository Path" field, note that the directory
cannot exist:
After filling in the fields, click on
"Create". If we have added the SSH key correctly, we will get a confirmation message and we will have successfully cloned our private repository via SSH:
Next steps
We leave you a guide to help you to configure the deploys and manage GIT from cPanel:
https://www.factoriadigital.com/soporte/es/tutoriales-y-preguntas-frecuentes/article/gestionar-git-desde-cpanel
Si todavía tienes dudas, contacta con nosotros y te ayudamos.