heyfletch
6/4/2015 - 9:59 PM

gitlab-init-remote

gitlab-init-remote

#!/bin/sh

# Modified from: https://coderwall.com/p/r7yh6g/create-a-new-gitlab-repo-from-the-command-line

# to use:
## Setup script locally:
# download gist (use this node helper: https://www.npmjs.com/package/download-gist)
# dg af568a27686e560de21d
# First, replace MyGitlabToken from https://gitlab.com/profile/account
# chmod +x gitlab-init-remote
# mv gitlab-init-remote /usr/local/bin/gitlab-init-remote

# To use:
# gitlab-init-remote my-cool-repo

repo=$1
token=MyGitlabToken

test -z $repo && echo "Repo name required." 1>&2 && exit 1

curl -H "Content-Type:application/json" https://gitlab.com/api/v3/projects?private_token=$token -d "{ \"name\": \"$repo\" }"