# Creating a GitLab Project and Assigning User Roles

In this guide, we will create a GitLab project and assign different roles (e.g., Developer, Maintainer) to users. We will also verify the access permissions for each role by performing various actions like merging and pushing.

# **Step 1: Create a New GitLab Project**

1. **Log In to GitLab**: Go to your GitLab instance and log in.
    
2. **Create a New Project**:
    

* Click on the **New Project** button.
    
* Choose **Create blank project**.
    
* Fill in the project details (e.g., Project Name, Description).
    
* Set the visibility level (Public, Internal, or Private).
    
* Click **Create project**.
    

# **Step 2: Invite Users to the Project**

1. **Go to Project Members**:
    

* Navigate to your project and click on **Settings** in the left sidebar.
    
* Click on **Members** under the Settings menu.
    

**2\. Invite Users**:

* In the **Invite members** section, enter the username or email of the user you want to add.
    
* Select the role from the dropdown menu (e.g., Developer, Maintainer).
    
* Click **Invite**.
    

# **Step 3: Assign Different Roles**

# **Example Roles:**

* **Maintainer**: Full control over the project (can push, merge, manage settings).
    
* **Developer**: Can push code and create merge requests but cannot manage project settings.
    

1. **Assign a User as Maintainer**:
    

* Invite a user and select the **Maintainer** role.
    

**2\. Assign a User as Developer**:

* Invite another user and select the **Developer** role.
    

# **Step 4: Verify Access Permissions**

# **Actions to Test:**

1. **Pushing Code**:
    

* As the Developer, try pushing code to the repository:
    

```bash
git clone https://gitlab.com/yourusername/yourproject.git
cd yourproject
touch test-file.txt
git add test-file.txt
git commit -m "Test file added"
git push origin main
```

* The Developer should be able to push changes.
    

**2\. Merging Code**:

* Create a new branch and make changes as the Developer:
    

```bash
git checkout -b feature-branch
echo "Some changes" > changes.txt
git add changes.txt
git commit -m "Add changes"
git push origin feature-branch
```

* Create a merge request from the Developer’s branch.
    
* As the Maintainer, attempt to merge the request:
    
* Go to **Merge Requests**, find the request, and click **Merge**.
    
* The Maintainer should be able to merge it without issues.
    

**3\. Changing Project Settings**:

* As the Maintainer, navigate to **Settings** &gt; **General** and attempt to change project settings.
    
* The Maintainer should have access to modify settings.
    

**4\. Testing Developer Limitations**:

* As the Developer, attempt to access project settings or manage members.
    
* The Developer should be denied access.
    

# **Conclusion**

You have successfully created a GitLab project, assigned different roles to users, and verified access permissions by performing actions like merging and pushing. This ensures proper management and security within your project. If you have any questions or need further assistance, feel free to ask!
