Mostafa Elhavary

๐Ÿ”‘ 2.3 Upload SSH Keys to a GitHub Repository

Lesson 7 of 816 min

Course outline ยท lesson 7 of 8

The video is in Arabic.

Finished 0 of 8 lessonsAsk on WhatsApp

In this video, we continue setting up the work environment and explain how to upload our SSH keys to a GitHub Repository.
You will learn how to:

  • Generate a new SSH key.

  • Add the Public Key to your GitHub account.

  • Verify that the SSH connection works.

  • Start using Git without typing your password every time.


    ๐Ÿ‘ฃ Steps to Create and Set Up an SSH Key on Linux and Upload It to GitHub

    1. Install Git (if it isnโ€™t installed)

    sudo apt update
    sudo apt install git -y

    2. Generate a New SSH Key

    Use the command:

    ssh-keygen -t ed25519 -C "[email protected]"
    • Replace [email protected] with the email registered on your GitHub account.

    • Press Enter when asked where to save the key (default path: ~/.ssh/id_ed25519).

    • You can leave the passphrase empty, or set a password on the key for extra security.

    3. Start the SSH Agent and Load the Key

    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_ed25519

    4. Copy the Public Key

    cat ~/.ssh/id_ed25519.pub

    Copy all of the text that appears.

    5. Add the Key to Your GitHub Account

    1. Open your GitHub account.

    2. Go to: Settings โ†’ SSH and GPG keys โ†’ New SSH key.

    3. Enter a title (for example: โ€œLinux VM Keyโ€) and paste the public key you copied.

    4. Save the changes.

    6. Test the Connection to GitHub

    ssh -T [email protected]
    • The first time, it will ask: Are you sure you want to continue connecting (yes/no)?

    • Type: yes

    • If everything is fine, you will see the message:

      Hi username! You've successfully authenticated, but GitHub does not provide shell access.

    7. Clone the Repo Using SSH

    Now, instead of the https URL, you will use the SSH URL:

    git clone [email protected]:username/repo.git

Sign in to save your progress

Sign in with your Google account. Your course progress is saved to your account and follows you to any device.