Generate and add an SSH key to GitHub using the command line. This setup is required to use limit-access-to-actor: true in your GitHub Actions tmate session.
- Install Necessary Tools.
sudo apt install openssh-client git -y- Generate the SSH Key. Run the following command, replacing the email with your GitHub account email.
ssh-keygen -t ed25519 -C "your_email@example.com"- Enter file in which to save: Press Enter to use the default location.
- Enter passphrase: Press Enter twice to skip, or provide a password for extra security.
- Copy the Public Key Display the content of your public key so you can copy it
cat ~/.ssh/id_ed25519.pubSelect the entire output text (starting with ssh-ed25519 and ending with your email) and Copy it.
- Add the Key to GitHub.
- Open your browser and log in to your GitHub SSH Settings.
- Click New SSH key.
- Title: Enter a name like "Terminal-debugging".
- Key: Paste the public key you copied from Terminal.
- Click Add SSH key.
5. Test the Connection Verify that Terminal can successfully connect to GitHub via SSH
ssh -T git@github.comIf successful, you will see a message: "Hi [YourUsername]! You've successfully authenticated..."
- Connect to your GitHub Action Once the Action starts and provides an SSH string, use it directly in Terminal.
ssh <provided_tmate_string>Because you added your key to GitHub and used limit-access-to-actor: true in your workflow, Terminal will now be the only device allowed to connect to that session
tmux set-option -g status off