Skip to content

Instantly share code, notes, and snippets.

@hxtree
Last active October 11, 2019 18:56
Show Gist options
  • Save hxtree/0594d8c3a9f1f2bf92947688b5e51c84 to your computer and use it in GitHub Desktop.
Save hxtree/0594d8c3a9f1f2bf92947688b5e51c84 to your computer and use it in GitHub Desktop.
SSH Deploy Key Setup
# Generate SSH Key
ssh-keygen -o -f ~/.ssh/www.example.com
# Add SSH key to your SSH config
vim ~/.ssh/config
Host www.example.com
User git
HostName www.example.com
IdentityFile ~/.ssh/www.example.com
# Add deploy Key to your Repo (e.g. Gitlab, GitHub, etc.)
cat ~/.ssh/www.example.com.pub
# within the website place text inside repo's Deploy Keys section
# enable write access to push, not needed for read.
# Push something, e.g.
cd /var/www/www.example.com
git init
git add .
git commit -m 'Init repo'
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment