0

I have a project in that I create github repo using curl like below

#!/bin/bash

# Create new github repo from the command line.
# Gather constant vars

# usage=> ./create.sh "name" "account" "token"

GITHUBUSER=$2
TOKEN=$3
NAME=$1
DESC="Blog of ${1}"


curl -s -u "${GITHUBUSER}:${TOKEN}" https://api.github.com/user/repos -d "{\"name\": \"${NAME}\", \"description\": \"${DESC}\", \"private\": false, \"has_issues\": true, \"has_downloads\": true, \"has_wiki\": false, \"has_pages\": true}"

# echo "done"
def create_github_repo()
   # new project repo on github
   system("cd scripts && chmod +x ./create.sh")
   system("cd scripts && ./create.sh #{self.username} #{Rails.configuration['gitusername']} #{ENV['token']}")
 end

I try to port to gitlab, what is the corresponding gitlab curl command available?

Hfyuu
  • 199
  • 1
  • 3
  • 11
  • 2
    Gitlab API is very well documented https://docs.gitlab.com/ee/api/projects.html#create-project – Nicolas Pepinster Aug 09 '19 at 13:16
  • `curl -H "Content-Type:application/json" https://gitlab.com/api/v3/projects?private_token=${TOKEN} -d "{ \"name\": \"${NAME}\", \"description\": \"${DESC}\", \"private\": false, \"has_issues\": true, \"has_downloads\": true, \"has_wiki\": false, \"has_pages\": true }"` Is this enough, I am not a coder. – Hfyuu Aug 09 '19 at 13:23
  • Does `-u "${GITHUBUSER}` needed? – Hfyuu Aug 09 '19 at 13:56
  • Don't put complex(ish) code in comments. You should update your Q to include that. Good luck. – shellter Aug 09 '19 at 14:01
  • https://stackoverflow.com/search?q=%5Bgitlab%5D+create+project+command+line – phd Aug 09 '19 at 15:20

0 Answers0