You are currently viewing How To Create A GitLab Project Using API

How To Create A GitLab Project Using API

How To Create A GitLab Project Using API

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have a basic overview of GitLab and its components, we have also created our 1st GitLab Project.

https://cloudaffaire.com/what-is-gitlab/

In this blog post, we will discuss how to create a GitLab Project using API and its features with a hands-on demo. The demo is created using API as we are taking a programmatic approach to cover most of the demo. But we have also provided the console steps as well so that if you want to perform the demo from GitLab console, you can do the same.

In order to access GitLab through API, you will need one private token for authorization. In the 1st step, we will create a private token.

How To Create A Private Token In GitLab?

Step 1: Log in to your GitLab account and in the top right corner, click your account icon and then click on ‘Settings’.

How To Create A GitLab Project Using API

Step 2: Navigate to ‘Access Tokens’. Provide a name and expiry date, scope and click ‘Create personal access token’.

How To Create A GitLab Project Using API

Our private access token created successfully. Copy the access token and keep in a safe place.

How To Create A GitLab Project Using API

Now we are ready for all the demo so lets get started.

What Is GitLab Project?

In GitLab, you can create projects for hosting your codebase, use it as an issue tracker, collaborate on code, and continuously build, test, and deploy your app with built-in GitLab CI/CD. Your projects can be available publicly, internally, or privately, at your choice and is controlled by project visibility. GitLab does not limit the number of private projects you create. In layman term a project is basically your git remote repository hosted in GitLab.

Project Visibility:

  • private: Project access must be granted explicitly for each user.
  • internal: The project can be cloned by any logged in user.
  • public: The project can be accessed without any authentication.

How To Create And Update A GitLab Project Using API?

What Is GitLab Project Repository?

A repository is what you use to store your codebase in GitLab and change it with version control. A repository is part of a project, which has a lot of other features.

How To Create And Update A File Directory In GitLab Project Repository Using API:

Commits:

Commits can be thought of as snapshots or milestones along the timeline of a Git project. Commits are created with the git commit command to capture the state of a project at that point in time.

How To Create, List and revert Commit In GitLab Project Repository:

Branches:

A branch is a version of a project’s working tree. You create a branch for each set of related changes you make. This keeps each set of changes separate from each other, allowing changes to be made in parallel, without affecting each other. GitLab sets master as the default branch for your project. Branches can also be protected to prevent unauthorized access.

How To Create, List And Merge GitLab Project Repository Branch:

Hope you enjoyed this article. In the next blog post, we will discuss how to create a GitLab project by importing from an external source.

To get more details on GitLab you can follow the below link.

https://docs.gitlab.com/ee/README.html

To Get more details on Git you can follow the below links.

https://cloudaffaire.com/category/devops/git/

https://git-scm.com/doc

 

Leave a Reply