Skip to content

Instantly share code, notes, and snippets.

@dhsathiya
Last active August 2, 2022 14:58
Show Gist options
  • Save dhsathiya/04fcc711f80a43163d8a55545ac307ee to your computer and use it in GitHub Desktop.
Save dhsathiya/04fcc711f80a43163d8a55545ac307ee to your computer and use it in GitHub Desktop.
tmate in GitHub Action
function install_tmate () {
apt update
apt install -y locales-all openssh-client xz-utils
ls -al ~/ & mkdir ~/.ssh/
wget https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz
tar xvf tmate-2.4.0-static-linux-amd64.tar.xz
mv tmate-2.4.0-static-linux-amd64/tmate /usr/bin/tmate
tmate -V
echo 'set +e' >/tmp/tmate.bashrc
ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa
set_default_command=(set-option -g default-command 'bash --rcfile /tmp/tmate.bashrc' ";")
tmate -v -S /tmp/tmate.sock "${set_default_command[@]}" new-session -d
tmate -S /tmp/tmate.sock wait tmate-ready
echo "####### TMATE #######"
tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'
}
install_tmate
sleep 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment