GitLab - Add a File

In this chapter, we will discuss about how to add a file to a project in the GitLab. We can add file in two ways −

  • Using Command Line Interface
  • Using Web Interface

Creating a file using Command Line Interface

Step 1 − To create a file by using command line interface, type the below command in your project directory −

GitLab Create File

Step 2 − Now go to your project directory and you will see the created file −

GitLab Create File

Creating a file using Web Interface

Step 1 − You can create a new file, by clicking on the '+' button which is at the right side of the branch selector in the dashboard −

GitLab Create File

Step 2 − Enter the file name, add some content in the editor section and click on the Commit changes button to create the file.

GitLab Create File

Step 3 − Now you will get a successful message after creating the file as shown below −

GitLab Create File
Kickstart Your Career

Get certified by completing the course

Get Started