Hello, I am trying to create a new repository under a particular group on gitlab using command line. The repository if it already exists should not create.
I also tried with the Group ID to add the repo but it is failing. Here is my code snippet... #!/bin/sh vrepo_name=$1 vgroup="Mygroup/Groupworkspace/groupproject" vtoken="mytokenhere" curl -H "Content-Type:application/json" https://gitlab.someurl.com/api/v4/projects?private_token=$vtoken -d "{ \"name\": \"$vrepo_name\" }" var1=`git ls-remote --heads g...@gilab.someurl.com:$vgroup/$1.git |wc -l` echo $var1 sleep 2 if [ $var1 = 0 ]; then git init git commit -m "First test from Cli" git remote add origin g...@gitlab.someurl.com:cor_app_iac_git_prd_fc/tf/vsphere/workspace/$vrepo_name.git else echo "Error creating gitlab repo via Cli $vrepo_name" exit 1 fi Question 1: So, the issue is it creates the git repo under my default group and I want it to create under another group. I understand Namespace path encoding is different. So, for vgroup variable should I be using %2F instead of a slash? vgroup="Mygroup/Groupworkspace/groupproject" But, it creates under "Mygroup/groupworkspace/<my default group>" Question 2 : Also, when it checks to see if repo is already there -> git ls-remote --heads on empty repo always returns a 0. How can I check if the repo empty or not exists? -- You received this message because you are subscribed to the Google Groups "GitLab" group. To unsubscribe from this group and stop receiving emails from it, send an email to gitlabhq+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/gitlabhq/188db6f5-6d7e-46dc-8379-deb84f499406%40googlegroups.com.