Skip to content

Instantly share code, notes, and snippets.

@walternascimentobarroso
Created July 8, 2024 13:17
Show Gist options
  • Select an option

  • Save walternascimentobarroso/f3fc73e5eea2b9ce0fffbb13aaae2d3a to your computer and use it in GitHub Desktop.

Select an option

Save walternascimentobarroso/f3fc73e5eea2b9ce0fffbb13aaae2d3a to your computer and use it in GitHub Desktop.

Revisions

  1. walternascimentobarroso created this gist Jul 8, 2024.
    17 changes: 17 additions & 0 deletions git-ssh.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash

    # Gera uma chave SSH com seu email
    echo "Digite o seu email para gerar a chave SSH:"
    read user_email
    ssh-keygen -t ed25519 -C "$user_email" -f ~/.ssh/id_ed25519 -N ""

    # Adiciona a chave SSH ao agente SSH
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_ed25519

    # Exibe a chave pública
    echo "Aqui está a sua chave pública SSH. Copie e adicione-a ao seu GitHub:"
    cat ~/.ssh/id_ed25519.pub

    # Abre a página de adição de nova chave SSH no GitHub (macOS only)
    open "https://github.com/settings/ssh/new"