Enable password-less ssh access:
cat ~/.ssh/id_rsa.pub | ssh username@server "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
# shortcut: copyrsa
Verify password-less login. (If unsuccessful, make sure the .ssh directory has 700
permissions, and authorized_keys has 600
permissions.)
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Create directory for repository and initialize bare git repository:
mkdir ~/git && cd ~/git
mkdir [myrepo].git && cd [myrepo].git
git init --bare
#shortcut ggitrepo
Create/edit post-receive
hook:
nano hooks/post-receive
post-receive
#!/bin/bash
GIT_WORK_TREE=../../[working_directory] git checkout -f master
# shortcut: gpostrec
Make sure post-receive has 755
permissions:
chmod +x hooks/post-receive
(Repeat for staging repository/working directory.)
Add a production
(and staging
) remote:
git remote add [production/staging] ssh://user@server.tld/path/to/repo.git
# shortcut: ggra
Push to production remote:
git push production HEAD:master
Install composer dependencies
composer install --no-dev
#shortcut ccind
Change .env.example to .env file and generate an application key
mv .env.example .env
php artisan key:generate