How Do You Add Files to a New Project in GitLab?

Problem scenario
You want to add files to a new project in GitLab.  You want to do this from the command prompt (not through the web UI).   How do you do this?

Solution
This assumes you have a new project created; if you do not know how, see this posting.  If you want to import a project, see this posting.

Procedures
1.  Make sure you have the regular git installed on your server.  (Installing GitLab does not necessarily install git.) Run this command to test it:  git --version

(Install git if the command was not recognized.)

2.  From the backend of the Linux server, run these commands but read the notes to the right of them before you run them as the commands are just drafts:

git config --global user.name "Administrator"
git config --global user.email "admin@continualintegration.com"  
 # change to email of your choice

git clone git@x.x.x.x:root/contint.git  # change x.x.x.x to the IP address of the GitLab server and change contint to the name of the project you just created
cd contint # change contint to the name of the project you just created
touch README.md
touch foobar.txt
git add .
git commit -m "added two new files"
git push -u origin master

3.  You have now uploaded files to a project in GitLab.

Leave a comment

Your email address will not be published.