Quantcast
Channel: Create a repo in Gitlab using CLI - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Answer by Chillar Anand for Create a repo in Gitlab using CLI

$
0
0

Since you just wanted to create a repo, there is no need of third party apps. You can directly send a post request to gitlab API which will create repo.

Go to account tab in your profile, you will find a private token. Copy that.

Now open terminal and run this command with private token (say foo) and your repo name (say bar).

curl -H "Content-Type:application/json" https://gitlab.com/api/v4/projects?private_token=foo -d "{ \"name\": \"bar\" }"

For convenience, you can create a shell script, if you don't want to run this command every time.

#!/bin/shcurl -H "Content-Type:application/json" https://gitlab.com/api/v4/projects?private_token=foo -d "{ \"name\": \"$1\" }"

Save this to a file gcr.sh and make it executable using chmod +x gcr.sh.

Now to create a repo name bar, run

$ ./gcr.sh bar

Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>