Created
November 20, 2017 16:56
-
-
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
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 | |
#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