Skip to content

Instantly share code, notes, and snippets.

@mjones129
Created April 16, 2024 13:42
Show Gist options
  • Save mjones129/e679c50e666f246038cf3bbc06ede4ea to your computer and use it in GitHub Desktop.
Save mjones129/e679c50e666f246038cf3bbc06ede4ea to your computer and use it in GitHub Desktop.
Git Set up for WP Engine
#!/bin/bash
# Install SSH and Git
sudo apt-get update
sudo apt-get install -y openssh-server git
# Prompt user for email
read -p "Enter your email for SSH key generation: " email
# Generate SSH keys with different names and ed25519 algorithm
ssh-keygen -t ed25519 -f ~/.ssh/wpengine_ed25519
ssh-keygen -t ed25519 -C "$email" -f ~/.ssh/wpegitkey
# Generate SSH config file for WP Engine
cat << EOF > ~/.ssh/config
Host *.ssh.wpengine.net
IdentityFile ~/.ssh/wpengine_ed25519
IdentitiesOnly yes
Host git.wpengine.com
User git
HostName git.wpengine.com
PreferredAuthentications publickey
IdentitiesOnly yes
EOF
# Output instructions
echo "SSH and Git installed."
echo "SSH key generated with ed25519 algorithm."
echo "SSH config file generated for WP Engine."
ssh_pub_key="$HOME/.ssh/wpengine_ed25519.pub"
paste_ssh="Paste the following into the ssh keys page on https://my.wpengine.com/profile/ssh_keys : "
echo "${paste_ssh}$(cat "$ssh_pub_key")"
paste_git="With SSH key in place, past this git key into any environment you wish to access: "
git_pub_key="$HOME/.ssh/wpegitkey.pub"
echo "${paste_git}$(cat "$git_pub_key")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment