Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SITIO="$1"
- USUARIO="$2"
- PUERTO="22"
- REPOSITORIO_REMOTO="/var/repo/$SITIO"
- SHEBANG="#!/bin/bash"
- SITIO_HTDOCS="/var/www/$SITIO"
- read -r -d '' HOOK <<EOF
- ${SHEBANG}
- echo ' * * * Actualizando $SITIO_HTDOCS * * * '
- GIT_WORK_TREE=$SITIO_HTDOCS git checkout -f
- echo ' * * * ยก Hecho ! * * * '
- EOF
- # Repositorio local
- git init
- echo ".DS_Store" > .gitignore
- git add .
- git commit -m "Repositorio local inicializado"
- # Repositorio Remoto
- ssh -p $PUERTO $USUARIO "mkdir -m 0775 $SITIO_HTDOCS; mkdir $REPOSITORIO_REMOTO; cd $REPOSITORIO_REMOTO; git init --bare; echo \"$HOOK\" > $REPOSITORIO_REMOTO/hooks/post-receive; chmod +x $REPOSITORIO_REMOTO/hooks/post-receive; exit;"
- wait
- # Repositorio local
- git remote add origin ssh://$USUARIO:$PUERTO$REPOSITORIO_REMOTO
- git push origin +master:refs/heads/master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement