tg-me.com/oleg_log/6039
Last Update:
Probably the best script of 2024 for me
And again gh/<username>.keys
(https://www.tg-me.com/us/oleg_log/com.oleg_log/5968)
#!/bin/bash
# Replace this with your GitHub username
GITHUB_USERNAME=$1
echo "Fetching for user $GITHUB_USERNAME"
# Fetch the public SSH keys from your GitHub account
GITHUB_KEYS=$(curl -s https://github.com/$GITHUB_USERNAME.keys)
# Check if the .ssh directory exists, if not create it
if [ ! -d "$HOME/.ssh" ]; then
echo "Creating ~/.ssh directory..."
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
fi
# Append the fetched GitHub public keys to the authorized_keys file
echo "Adding GitHub SSH keys to ~/.ssh/authorized_keys..."
echo "$GITHUB_KEYS" >> "$HOME/.ssh/authorized_keys"
# Set the correct permissions for the authorized_keys file
chmod 600 "$HOME/.ssh/authorized_keys"
echo "GitHub SSH keys have been added successfully!"
BY oleg_log
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Share with your friend now:
tg-me.com/oleg_log/6039