Last active
June 19, 2024 03:06
-
-
Save nicolabricot/2d488601712b2723544e to your computer and use it in GitHub Desktop.
Creation of Git deployment key for user www-data on Debian
This file contains 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
# 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 | |
# rename keys | |
cd .ssh | |
mv id_rsa service_deployment_www-data | |
mv id_rsa.pub service_deployment_www-data.pub | |
# link key to our service host | |
nano config | |
# Host service.org | |
# HostName service.org | |
# User git | |
# IdentityFile ~/.ssh/service_deployment_www-data | |
chown www-data:www-data config | |
# 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
To clone a repository as the
www-data
user:And to update it:
If you have the following error:
you probably need to add the Service.org server to the list of authorized hosts