Last active
April 5, 2025 05:22
-
-
Save MarkWalters-dev/238e167a8258942e8a9633dd22e815b2 to your computer and use it in GitHub Desktop.
setup ssh in replit
This file contains hidden or 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
#!/usr/bin/env bash | |
[ -f "$HOME/.ssh/config" ] || { | |
[ -n "$id_rsa" ] || crash "Error: Missing id_rsa in secrets." | |
[ -n "$id_rsa_pub" ] || crash "Error: Missing id_rsa_pub in secrets." | |
# [ -n "$mw" ] || crash "Error: Missing mw in secrets." | |
# [ -n "$mwuser" ] || crash "Error: Missing mwuser in secrets." | |
# [ -n "$mwport" ] || crash "Error: Missing mwport in secrets." | |
mkdir -p "$HOME/.ssh" || crash | |
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > "$HOME/.ssh/id_rsa" || crash | |
echo -e "${id_rsa// /$'\n'}" >> "$HOME/.ssh/id_rsa" || crash | |
echo "-----END OPENSSH PRIVATE KEY-----" >> "$HOME/.ssh/id_rsa" || crash | |
echo -e "$id_rsa_pub" > "$HOME/.ssh/id_rsa.pub" || crash | |
chmod 700 "$HOME/.ssh" || crash | |
chmod 600 "$HOME/.ssh"/* || crash | |
eval "$(ssh-agent -s)" | |
# Add your SSH key to the agent | |
ssh-add ~/.ssh/id_rsa | |
# Configure Git to use SSH instead of HTTPS | |
git config --global url."[email protected]:".insteadOf "https://github.com/" | |
git config --global user.email "$git_email" | |
git config --global user.name "$git_user" | |
} | |
scp -P 22 aad612be-9b43-47e2-bee4-e64855ee035b@aad612be-9b43-47e2-bee4-e64855ee035b-00-1w8cpaxz46kw3.spock.replit.dev:bin/etc/sshconfig "$HOME/.ssh/config" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment