Skip to content

Instantly share code, notes, and snippets.

@aVolpe
Created Nov 20, 2017
Embed
What would you like to do?
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