Search code examples
laravelforge

Laravel Forge - Update Server Public SSH key


So, for some reason I deleted my servers forge accounts SSH keys and created new ones. Now Laravel forge still has the old public key and it's the same it added to github. Is there a way to update the public ssh key that forge uses for my server


Solution

  • Stole a script on how laravel forge itself is setup

    # generate new ssh key
    ssh-keygen -f /home/forge/.ssh/id_rsa -t rsa -N ''
    
    # Copy Source Control Public Keys Into Known Hosts File
    
    ssh-keyscan -H github.com >> /home/forge/.ssh/known_hosts
    ssh-keyscan -H bitbucket.org >> /home/forge/.ssh/known_hosts
    ssh-keyscan -H gitlab.com >> /home/forge/.ssh/known_hosts