Last active
December 18, 2016 08:58
-
-
Save petriichuk/971f40f9bd04c33cce28e56aafb61e8a to your computer and use it in GitHub Desktop.
ServerConfigurationCommands(Ubuntu 16.4)
This file contains hidden or 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
https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps | |
#REMOTE SERVER | |
#install | |
sudo apt-get install git-core | |
#copy your username and email in the gitconfig file | |
sudo nano ~/.gitconfig | |
git config --global user.name "NewUser" | |
git config --global user.email [email protected] | |
#show your settings | |
git config --list | |
#creatingWebRepoForDeploy | |
cd ~/ | |
mkdir repo && cd repo | |
mkdir site.git && cd site.git | |
#createRepoWithoutSourceFiles | |
git init --bare | |
#createHook | |
cd hooks | |
nano post-receive | |
#PutThereNextContent | |
#!/bin/sh | |
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f | |
#giveItExecutePerm | |
chmod +x post-receive | |
#LOCAL | |
cd ~/projects/ | |
mkdir project && cd project | |
git init | |
#AddRemote | |
git remote add live ssh://[email protected]/home/user/repo/site.git | |
#FirstCommit | |
git add . | |
git commit -m "Init" | |
#FirsForcePushToLiveRemote | |
git push -f live master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment