Search code examples
ubuntugithubsshssh-keys

Cloning GITHUB project to ubuntu 22


I've had to wipe and reinstall my ubuntu server twice now due to failing and some how corrputing/locking my self out of the server when it comes to setting up the SSH.

I'm going out on a whim and hoping some one who reads this knows where to find an easy to follow tutorial for cloning a project to ubuntu using SSH as they dont allow HTTP cloning now.

Many thanks.


Solution

  • first setup your ssh key following github tutorial to create a key pair and add to your account

    then in your ssh config(in your ~/.ssh folder) set up a config file to forward the ssh-agent after you ssh into a server. You can read more about this in github docs

    here is an example of a config file in the ssh folder:

    Host example.com # or the server ip
      AddKeysToAgent yes
      UseKeychain yes
      IdentityFile ~/.ssh/id_rsa # your secret key file
      ForwardAgent yes
    

    When everything is done, try ssh into your server and git clone with the repo ssh url