How to Create a Project in Gitlab
To Create a Project in GitLab
GitLab is a web based project management repository based on Git. It lets you to create and manage your projects effectively. As a part of our GitLab series, we have covered several articles related to creating a group and to add users to group. Also, we have covered the method to take a backup and to restore files from the GitLab. In this article, we will learn about the method to create a project on GitLab. It is quite simple to create a project in GitLab.
To Create a Project
Log into your GitLab with your administrator credentials using your web browser. Once logged in, choose the “ Admin Area” as shown in the following image.
In the Admin Area, you will see the number of projects, users and groups available on your GitLab. Click “ New Project” to create new one.
Create a new project by entering details such as Project path, Project name, Project description and Visibility Level as shown in following image.
A new project is created, now you need to create a repository for the newly created project. You can find some set of commands after creating project we need to run it in order to create repository.
To create a Repository for your project
In order to create a repository, make sure you run the global setup. But, before that, use the following command to verify if your server is compatible with git command.
If the server doesn' t support git command, use ‘ yum install git -y’ command.
[root@git ~]# git config --global user.name " root"
[root@git ~]# git config --global user.email admin@example.com
Now you can use the following command to clone git repository.
[root@git ~]# git clone http://root@192.168.5.143/root/sample-project.git
Cloning into ' sample-project' ...
Password for ' http://root@192.168.5.143' :
warning: You appear to have cloned an empty repository.
Initially you will get warning message for the empty repository. After cloning you will see a directory created under your current working directory in the name of your project you have created in gitlab.
[root@git ~]# ls
anaconda-ks.cfg Desktop Documents Downloads initial-setup-ks.cfg Music Pictures Public sample-project Templates Videos
Navigate to the newly created directory and create file called “ README.md”
[root@git ~]# cd sample-project/
[root@git sample-project]# touch README.md
Once a new file is created in repository, you can use the git command to add them.
In order to add the file into the Git, you can use the following command.
[root@git sample-project]# git add README.md
Once the file is added, commit it using the following command.
[root@git sample-project]# git commit -m " add README"
[master (root-commit) d490e1d] add README
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
Once the file is committed, push it to Git.
[root@git sample-project]# git push -u origin master
Password for ' http://root@192.168.5.143' :
Counting objects: 3, done.
Writing objects: 100% (3/3), 210 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://root@192.168.5.143/root/sample-project.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
While you push the file into Git, you will be asked to enter password. Use your GitLab administrator login password. Refresh your page, you will see a new tab for Repository.
By this way, you can easily add a new project in your GitLab, and also create a repository for that project.
Comments ( 0 )
No comments available