Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. SITIO="$1"
  4. USUARIO="$2"
  5. PUERTO="22"
  6. REPOSITORIO_REMOTO="/var/repo/$SITIO"
  7. SHEBANG="#!/bin/bash"
  8. SITIO_HTDOCS="/var/www/$SITIO"
  9. read -r -d '' HOOK <<EOF
  10. ${SHEBANG}
  11. echo ' * * * Actualizando $SITIO_HTDOCS * * * '
  12. GIT_WORK_TREE=$SITIO_HTDOCS git checkout -f
  13. echo ' * * * ยก Hecho ! * * * '
  14. EOF
  15.  
  16.  
  17. # Repositorio local
  18. git init
  19. echo ".DS_Store" > .gitignore
  20. git add .
  21. git commit -m "Repositorio local inicializado"
  22.  
  23. # Repositorio Remoto
  24. 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;"
  25. wait
  26.  
  27. # Repositorio local
  28. git remote add origin ssh://$USUARIO:$PUERTO$REPOSITORIO_REMOTO
  29. git push origin +master:refs/heads/master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement