5

I want to add a new project on Gitlab only using the command line (bash). Is there a way or do I have to go to the Gitlab page and add the project via GUI?

I explicitely don't mean to add a local repository to a remote - I know how to do this. I merely look for a way to do the project creation step as well from the terminal without heading over to the Gitlab page.

phd
  • 82,685
  • 13
  • 120
  • 165
aerioeus
  • 1,348
  • 1
  • 16
  • 41
  • 3
    You might want to check out the API of github or gitlab. Maybe [this](https://forum.gitlab.com/t/create-a-new-project-in-a-group-using-api/1552) is even the answer you're looking for, but I didn't look at that too closely – lucidbrot Jan 01 '18 at 17:37
  • Yep, seems to be doable with github too: https://developer.github.com/v3/repos/#create – kLabz Jan 01 '18 at 17:39
  • 1
    Thank you guys, all valuable leads...I need to dig into it. But the idea using the API seems the road to go... – aerioeus Jan 01 '18 at 21:45
  • I believe that solves it: https://forum.gitlab.com/t/create-a-new-project-in-a-group-using-api/1552. ; thank you lucidbrot – aerioeus Jan 01 '18 at 22:25

1 Answers1

3

Short answer no, because you are using Git SCM, which is not specially designed for GitHub, Gitlab, Bitbucket or even local repo. Git SCM is designed to integrate with every Git version control repository.

But you can write a custom command on Git SCM or shell script to integrate with GitLab or GitHub API to create new repo easily.

Open .gitconfig file and then add following command:

[alias]
create-repo = !sh -c "curl -i -H 'Authorization: token YOUR_GITHUB_TOKEN' -X POST ....

And then run git create-repo name

Bartłomiej
  • 1,068
  • 1
  • 14
  • 23
Mehdi Hosseini
  • 1,937
  • 1
  • 18
  • 29