Last active
April 4, 2020 00:23
-
-
Save raco/904d235c6c5939110bd218fd32fb4259 to your computer and use it in GitHub Desktop.
Script to install a git bare repository to deploy easily
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
#!/bin/sh | |
# | |
export DEBIAN_FRONTEND=noninteractive; | |
# Define a project name | |
projectname='your_project_name'; | |
cd /var/www; | |
mkdir $projectname; | |
cd /var; | |
mkdir repo; | |
cd repo; | |
mkdir $projectname; | |
cd $projectname; | |
mkdir site.git; | |
cd site.git; | |
git init --bare; | |
cd hooks; | |
sudo touch post-receive; | |
echo "#!/bin/sh | |
git --work-tree=/var/www/$projectname --git-dir=/var/repo/$projectname/site.git checkout -f" > post-receive; | |
sudo chmod +x post-receive; | |
green=`tput setaf 1` | |
reset=`tput sgr0` | |
echo "${green}---------LISTO AHORA: git remote add development "USER"@"SERVER_IP":/var/repo/$projectname/site.git | |
-----${reset}"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment