Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new project on Github/ Gitlab via Terminal [duplicate]

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.

like image 756
aerioeus Avatar asked Oct 17 '22 00:10

aerioeus


1 Answers

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

  • Gitlab API - create project
  • GitHub API - create repository
  • Git SCM - Aliases
like image 79
Mehdi Hosseini Avatar answered Oct 20 '22 10:10

Mehdi Hosseini