Skip to content

Instantly share code, notes, and snippets.

@hedefalk
Created December 3, 2016 21:54
Show Gist options
  • Save hedefalk/19bd90f097a21ca90763fe6218910cae to your computer and use it in GitHub Desktop.
Save hedefalk/19bd90f097a21ca90763fe6218910cae to your computer and use it in GitHub Desktop.
push a new repo to gitlab
#!/bin/sh
repo_name=$1
token=`pass show gitlab/access-token`
test -z $repo_name && 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_name\" }"
git remote add origin "git@gitlab.com:hedefalk/$repo_name.git"
git push --set-upstream origin master
@hedefalk
Copy link
Author

hedefalk commented Dec 3, 2016

Courtesy of https://coderwall.com/p/r7yh6g/create-a-new-gitlab-repo-from-the-command-line, just put my access token in pass: https://www.passwordstore.org/

Since git do magic with git-*, you can do git init-gitlab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment