Skip to content

Instantly share code, notes, and snippets.

@aVolpe
Created November 20, 2017 16:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aVolpe/dd35efd1c3cf1ccece448c5edb9086d7 to your computer and use it in GitHub Desktop.
Save aVolpe/dd35efd1c3cf1ccece448c5edb9086d7 to your computer and use it in GitHub Desktop.
Push a folder full of git repositories to a new created projects in gitlab
#!bin/bash
#set -x
for i in $(find $1 -type d -maxdepth 1);
do
NAME=`basename $i | sed -e 's/[a-z]*_//'`;
# Excluimos la carpeta principal
if [ "$NAME" == "repos" ]
then
continue # Skip rest of this particular loop iteration.
fi
ROOT=`pwd`
echo "Creando proyecto"
curl -H "Content-Type:application/json" $GITLAB_API_ENDPOINT/api/v3/projects?private_token=$GITLAB_API_PRIVATE_TOKEN -d "{ \"name\": \"$NAME\", \"namespace_id\": $1 }" | python -m json.tool
sh $ROOT/create_project.sh $NAME 41
cd $i
git remote add local $GITLAB_API_ENDPOINT/facturador/microservicios/$NAME.git
git push local --all
#echo $NAME
cd $ROOT
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment