Last active
August 29, 2015 14:03
-
-
Save elmijo/d583bb392b43ba82c507 to your computer and use it in GitHub Desktop.
Comando que permite iniciar un repositorio remoto en tu local
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/bash | |
argumentsToVar(){ | |
for var in "$@" | |
do | |
varname=`echo "$var"|cut -d'=' -f 1 | cut -c 3-` | |
varname=${varname//-/} | |
eval ${varname}=`echo "$var"|cut -d'=' -f 2` | |
done | |
} | |
repodir=/var/www | |
githost=https://github.com | |
propietario=janselmi | |
textcommit="Inicio del proyecto" | |
argumentsToVar "$@" | |
prodir="$repodir/$proyecto" | |
filereadme="$prodir/README.md" | |
if [ -z $gitssh ] ; | |
then | |
origen="$githost/$propietario/$proyecto.git" | |
else | |
hostname=${githost/http:\/\//} | |
hostname=${hostname/https:\/\//} | |
origen="git@$hostname:$propietario/$proyecto.git" | |
fi | |
mkdir $prodir | |
git init $prodir | |
echo $readme > $filereadme | |
cd $prodir | |
git add $filereadme | |
git commit -m "$textcommit" | |
git remote add origin $origen | |
git push -u origin master | |
echo "Ir al directorio del Proyecto:" | |
echo "" | |
echo "cd $prodir" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Iniciar Git Repo en mi Local
Este script permite inicializar un Repositorio Git que se acaba de crear en tu local. Es parametrizable y simple de usar
Parametros
Ejemplo