Generating an SSH Key for Secure Deployment of GitHub Repositories to cPanel

Prerequisites:

  • A GitHub account with your repository
  • A cPanel account
  • Basic knowledge of Git and SSH

Step 1: Generate an SSH Key

  • Open Terminal: On your local machine, open a terminal or command prompt.
  • Create an SSH key pair:

ssh-keygen -t rsa -b 4096 -C "user_name@domain_name"        

Replace user_name@domain_name with your actual email address.

  • Follow prompts: Enter a passphrase for your private key when prompted. (optional)
  • Locate the key files: The public key (id_rsa.pub) will be saved in your home directory's .ssh folder.
  • Creates a new file named config within the .ssh directory in your home directory.

touch ~/.ssh/config        

  • Sets the permissions of the config file to 0600.

chmod 0600 ~/.ssh/config        


  • Changes the ownership of the config file to the specified username.

chown username:username ~/.ssh/config        

  • After that go to cpanel ssh access option and grant authorize to the ssh key.
  • Download the key and add to your git repository.

Md. Alwoadud Ripon

Software Engineer @ E.B. Solutions Ltd | PHP | Laravel | Full Stack Developer | Payments Gateway Integration| Docker | Redis.

7 个月

Useful tips ??

要查看或添加评论,请登录

社区洞察

其他会员也浏览了