Skip to content

Instantly share code, notes, and snippets.

@guillaumepotier
Forked from nicolabricot/deployment_key.sh
Last active September 18, 2020 08:32
Show Gist options
  • Save guillaumepotier/540209652d0f60c92aa008d99f725713 to your computer and use it in GitHub Desktop.
Save guillaumepotier/540209652d0f60c92aa008d99f725713 to your computer and use it in GitHub Desktop.
Creation of Git deployment key for user www-data on Debian
# let's be root
su
# go the apache folder
cd /var/www
# create folder to store keys
mkdir .ssh
chown -R www-data:www-data .ssh
# create keys
sudo -u www-data ssh-keygen -t rsa
# add it to gh
# add known hosts
# https://stackoverflow.com/questions/40442476/github-authentication-failed-with-user-www-data
ssh-keyscan -t rsa github.com >> /var/www/.ssh/known_hosts
# update a repository
cd /data/git/some-repository
sudo -u www-data git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment