Last active
August 2, 2022 14:58
-
-
Save dhsathiya/04fcc711f80a43163d8a55545ac307ee to your computer and use it in GitHub Desktop.
tmate in GitHub Action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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