+1 vote
in General by (11.2k points)
How can I add a new file to Gitlab repository using the command line?

1 Answer

0 votes
by (16.1k points)

Follow these steps to add a file to your Gitlab repository:

1. Open a terminal/shell, and change into the folder of your GitLab project.

2. Check if git is installed on your machine by typing command:

git status

If git is not installed, type the following command to install git on your machine:

sudo apt install git-all

3. To add your file, type the following command:

git add <name of file>

4. Commit (save) your file to the repository:

git commit -m "DESCRIBE COMMIT IN A FEW WORDS"

5. Now you can push (send) your changes (in the branch <branch-name>) to GitLab (the git remote named ‘origin’):

git push origin <branch-name>
e.g. git push origin master

Your file will be added to your branch in your repository in GitLab.

Source: https://docs.gitlab.com/ee/gitlab-basics/add-file.html

...